创建配置单元外部表时出现错误

时间:2019-01-20 18:25:51

标签: hadoop hive hql

在创建外部配置单元表时低于错误配置单元(偏黄色)

CREATE EXTERNAL TABLE yatish_h1b_data_ak 
(    
     ID:INT,
     CASE_STATUS:VARCHAR,
     EMPLOYER_NAME:VARCHAR,
     SOC_NAME:VARCHAR,
     JOB_TITLE:VARCHAR,
     FULL_TIME_POSITION:VARCHAR,
     PREVAILING_WAGE:FLOAT,
     YEAR:INT,
     WORKSITE:VARCHAR,
     LONGITUDE:VARCHAR,
     LATITUDE:VARCHAR 
)
ROW FORMAT DELIMITED              
FIELDS TERMINATED BY \073' LINE TERMINATED BY '\n'              
LOCATION user/seethayatish/yatish; 
  

NoViableAltException(9 @ [])
  在org.apache.hadoop.hive.ql.parse.HiveParser.type(HiveParser.java:40648)>在org.apache.hadoop.hive.ql.parse.HiveParser.colType(HiveParser.java:40405)在org。 org.apache.hadoop上的apache.hadoop.hive.ql.parse.HiveParser.columnNameType(HiveParser.java:40089)位于org.apache.hadoop.hive.ql.parse.HiveParser.columnNameTypeList(HiveParser.java:38213)位于org.apache.hadoop。 org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:4122)上的hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:6726)在org.apache.hadoop.hive.ql。 org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1152)处的parse.HiveParser.execStatement(HiveParser.java:1786)在org.apache.hadoop.hive.ql.parse.ParseDriver。在org.apache.hadoop.hive.ql.Driver.compile(Driver.java :)处解析(ParseDriver.java:211)在org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:171) 447),网址为org.apache.hadoop.hive.ql.Driver.compil e(Driver.java:330)在org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1233)在org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1274)在org.apache.hadoop.hive.ql.Driver.run(Driver.java:1160)在org.apache.hadoop.hive.ql.Driver.run(Driver.java:1160)在org.apache.hadoop.hive org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:169)上的.cli.CliDriver.processLocalCmd(CliDriver.java:217)org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver .java:380),位于org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:740),位于org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:685)。 apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)位于sun.reflect.NativeMethodAccessorImpl.invoke0(本地方法)位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)在sun.reflect。 DelegatingMethodAccessorImpl.invoke(Delegati ngMethodAccessorImpl.java:43),位于org.apache.hadoop.util.java.lang.reflect.Method.invoke(Method.java:498),org.apache.hadoop.util,RunJar.run(RunJar.java:233) .RunJar.main(RunJar.java:148)失败:ParseException行1:45无法识别列类型中':''INT'','附近的输入

1 个答案:

答案 0 :(得分:0)

您错误地编写了Creat表语句。字段名称及其数据类型之间没有冒号(:)。只需在字段名称及其数据类型之间保留空格。此外,配置单元中不支持VARCHAR和FLOAT类型,而不是使用STRING和DOUBLE。

以下是正确的陈述:

CREATE EXTERNAL TABLE yatish_h1b_data_ak ( 

ID                   INT,
CASE_STATUS          STRING,
EMPLOYER_NAME        STRING,
SOC_NAME             STRING,
JOB_TITLE            STRING,
FULL_TIME_POSITION   STRING,
PREVAILING_WAGE      FLOAT,
YEAR                 INT,
WORKSITE             STRING,
LONGITUDE            STRING,
LATITUDE             STRING ) 

ROW FORMAT DELIMITED  

FIELDS TERMINATED BY '\073' 

LINES TERMINATED BY '\n' 

LOCATION '/user/seethayatish/yatish';