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
gefragt vor 5 Jahren1755 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen