How to query .json.gz files from Amazon Athena?

0

I am trying to query the .json.gz files from amazon Athena, somehow i am not able to query as the way that I am doing for normal files.

I am using Glue Crawler to crawl the data into glue catalog and then querying it using Amazon Athena.
I do have only one file per folder and glue is able to crawl those properly, the issue is in querying the files using athena.

I am getting the below error.

​​​​

HIVE_METASTORE_ERROR: com.facebook.presto.spi.PrestoException: Error: : expected at the position 23 of 'struct<OS:struct<device ID:string,deviceType:string,platform:string,version:string,deviceManufacturer:string,deviceSize:string>,app:struct<app_version:string,auth_server:string,gui_version:string,lang:string,name:string,ua:string>,campaign:string,library:structname:string,version:string,page:structpath:string,referrer:string,search:string,title:string,url:string,userAgent:string,ip:string>' but ' ' is found. (Service: null; Status Code: 0; Error Code: null; Request ID: null)

This query ran against the "new1" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: e25ec322-c5d

Any help appreciated.
Thanks in advance.

Edited by: dxaws on Jun 4, 2019 5:36 AM

dxaws
asked 5 years ago1728 views
1 Answer
0
Accepted Answer

This is because you gzipped a file pretty json instead of flattened json. You should flattend json instead of pretty json to work with Athena Queries.

raghuRR
answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions