在使用athena创建分区时,输入“create external”没有可行的替代方法

nnvyjq4y  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(333)

我以这样的配置单元格式将分区数据存储在s3中。 /bucket/date=2017-02-20 /bucket/date=2017-20-25 现在我运行以下来自athena的查询来创建分区 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/' 引发以下异常 no viable alternative at input 'create external' (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: 6a4e0852-f8b0-11e6-b606-e52f2622374b) 任何帮助都将不胜感激。
谢谢

fd3cxomn

fd3cxomn1#

PARTITIONED BY (date string) 应在列定义范围之外

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/'

相关问题