在使用雅典娜创建分区时,在输入“创建外部”时没有可行的替代方案

时间:2021-12-08 01:00:52

I have stored partitioned data in s3 in hive format like this.

我在s3中以这样的hive格式存储分区数据。

/bucket/date=2017-02-20 /bucket/date=2017-20-25

/桶/日期= 2017-02-20 /桶/日期= 2017-02-20

Now i am running following query from Athena to create partition

现在我正在运行雅典娜的查询来创建分区

CREATE EXTERNAL TABLE hive3( battery double, longitude double, application string, latitude double, device_id string, trip_id string, id int, accuracy double, PARTITIONED BY (date string) ) ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' WITH SERDEPROPERTIES ('serialization.format' = '1') LOCATION 's3://bucket/'

创建外部表hive3(电池双、经度双、应用程序字符串、纬度双、device_id字符串、trip_id字符串、id int、准确度双、按(日期字符串)分区)行格式SERDE ' org.apachve.hcatalog.data。与SERDEPROPERTIES JsonSerDe”(“序列化。格式' = '1')位置's3://桶/'

Throwing following exception

抛出异常后

no viable alternative at input 'create external' (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: 6a4e0852-f8b0-11e6-b606-e52f2622374b)

在输入“创建外部”(服务:amazonathena;状态码:400;错误代码:invalidrequestexception;请求id:6 a4e0852-f8b0-11e6-b606-e52f2622374b)

Any help would be appreciated.

如有任何帮助,我们将不胜感激。

Thanks

谢谢

1 个解决方案

#1


4  

PARTITIONED BY (date string) should be outside the columns definition scope

通过(日期字符串)进行分区应该在列定义范围之外

CREATE EXTERNAL TABLE hive3(
    battery double,
    longitude double,
    application string,
    latitude double,
    device_id string,
    trip_id string,
    id int,
    accuracy double
  )
PARTITIONED BY (date string) 
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
WITH SERDEPROPERTIES ('serialization.format' = '1') 
LOCATION 's3://bucket/'

#1


4  

PARTITIONED BY (date string) should be outside the columns definition scope

通过(日期字符串)进行分区应该在列定义范围之外

CREATE EXTERNAL TABLE hive3(
    battery double,
    longitude double,
    application string,
    latitude double,
    device_id string,
    trip_id string,
    id int,
    accuracy double
  )
PARTITIONED BY (date string) 
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
WITH SERDEPROPERTIES ('serialization.format' = '1') 
LOCATION 's3://bucket/'