【问题标题】:Can't understand this Athena create table error无法理解这个 Athena 创建表错误
【发布时间】:2020-03-26 12:03:11
【问题描述】:

有没有更好的方法来检查我下面的create table语句,Athena一直给我无用的错误,

line 1:8: no viable alternative at input 'create external' (service: amazonathena; status code: 400; error code: invalidrequestexception;)
CREATE EXTERNAL TABLE IF NOT EXISTS database_1.table_1(
  `id` string,  
  `starttime` string, 
  `endtime` string, 
  `projectedflow` int, 
  `volume` int, 
  `occupancy` int, 
  `averagespeed` int, 
  `maxlaneoccupancy` int, 
  `minlaneaveragespeed` int, 
  `maxflow` int, 
  `sustainableflow` int, 
  `site_id` int as SPLIT(id, ':')[1], 
  `region` string as SPLIT(id, ':')[3], 
  `starthour` int as SPLIT(SPLIT(starttime, 'T')[2], ':')[1], 
  `startminute` int as SPLIT(SPLIT(starttime, 'T')[2], ':')[2], 
  `starttime_adj` date as CONCAT(SPLIT(starttime, 'T')[1], ' ', SPLIT(SPLIT(starttime, 'T')[2], 'Z')[1]), 
  `endtime_adj` date as CONCAT(SPLIT(endtime, 'T')[1], ' ', SPLIT(SPLIT(endtime, 'T')[2], 'Z')[1])
  )
PARTITIONED BY ( 
  `year` int, 
  `month` int, 
  `day` int)
ROW FORMAT DELIMITED 
  FIELDS TERMINATED BY ',' 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  's3://bucket_1/traffic/v1/ds/csv'
TBLPROPERTIES (
  'areColumnsQuoted'='false', 
  'classification'='csv', 
  'columnsOrdered'='true', 
  'compressionType'='gzip', 
  'delimiter'=',', 
  'skip.header.line.count'='4');

我们将不胜感激任何有关策略的建议。

【问题讨论】:

    标签: amazon-athena


    【解决方案1】:

    由于您的表名包含数字table_1,因此请用双引号将其括起来,例如"table_1"

    请参阅此处以获取 CREATE TABLE 文档。

    【讨论】:

      猜你喜欢
      • 2012-12-09
      • 1970-01-01
      • 2019-09-20
      • 2020-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多