0

I'm trying to make a partitioned data table in Amazon Athena, so that I can analyze the contents of a bucket containing S3 access logs. I've followed the instructions almost exactly as they are written in the docs, just substituting my own info. However, I keep getting the error line 1:8: no viable alternative at input 'create external' (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: 847e3d9c-8d3c-4810-a98c-8527270f8dd8). Here's what I'm inputting:

CREATE EXTERNAL TABLE access_data (
         `Date` DATE,
         Time STRING,
         Location STRING,
         Bytes INT,
         RequestIP STRING,
         Host STRING,
         Uri STRING,
         Status INT,
         Referrer STRING,
         os STRING,
         Browser STRING,
         BrowserVersion STRING 
) 
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
WITH serdeproperties ( 'paths'='`Date`,Time, Uri' )
PARTITIONED BY (dt DATE) STORED AS parquet LOCATION 's3://[source bucket]/';

I've looked at other similar questions on here but I don't have a hyphenated table name, no trailing commas, no unbalanced back ticks or missing parentheses, etc... so I really don't know what's wrong. Thanks to anyone who can help!

1 Answers1

0

It appears that these two lines are conflicting with each other:

ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' WITH serdeproperties ...

and

STORED AS parquet

Removing one of them allows the table creation to proceed.

Parquet does not store data in JSON format.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470