我在mac上设置了Hive。执行简单的创建外部表查询时。我得到下面的堆栈跟踪:
hive> CREATE EXTERNAL TABLE weatherext ( wban INT, date STRING)
> ROW FORMAT DELIMITED
> FIELDS TERMINATED BY ‘,’
> LOCATION ‘ /hive/data/weatherext’;
org.apache.hadoop.hive.ql.parse.hiveparser.columnnametypeorpkorfk(hiveparser)上的noviableException(80@[])。java:33341)在org.apache.hadoop.hive.ql.parse.hiveparser.columnnametypeorpkorfklist(hiveparser。java:29513)在org.apache.hadoop.hive.ql.parse.hiveparser.createtablestatement(hiveparser)上。java:6175)在org.apache.hadoop.hive.ql.parse.hiveparser.ddlstatement(hiveparser。java:3808)在org.apache.hadoop.hive.ql.parse.hiveparser.execstatement(hiveparser。java:2382)在org.apache.hadoop.hive.ql.parse.hiveparser.statement(hiveparser。java:1333)在org.apache.hadoop.hive.ql.parse.parsedriver.parse(parsedriver。java:204)在org.apache.hadoop.hive.ql.parse.parseutils.parse(parseutils。java:77)在org.apache.hadoop.hive.ql.parse.parseutils.parse(parseutils。java:70)在org.apache.hadoop.hive.ql.driver.compile(driver。java:468)位于org.apache.hadoop.hive.ql.driver.compileinternal(驱动程序。java:1316)在org.apache.hadoop.hive.ql.driver.runinternal(driver。java:1456)在org.apache.hadoop.hive.ql.driver.run(驱动程序。java:1236)在org.apache.hadoop.hive.ql.driver.run(driver。java:1226)在org.apache.hadoop.hive.cli.clidriver.processlocalcmd(clidriver。java:233)在org.apache.hadoop.hive.cli.clidriver.processcmd(clidriver。java:184)在org.apache.hadoop.hive.cli.clidriver.processline(clidriver。java:403)在org.apache.hadoop.hive.cli.clidriver.executedriver(clidriver。java:821)在org.apache.hadoop.hive.cli.clidriver.run(clidriver。java:759)位于org.apache.hadoop.hive.cli.clidriver.main(clidriver。java:686)在sun.reflect.nativemethodaccessorimpl.invoke0(本机方法)在sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl)。java:62)在sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl。java:43)在java.lang.reflect.method.invoke(方法。java:498)在org.apache.hadoop.util.runjar.run(runjar。java:221)在org.apache.hadoop.util.runjar.main(runjar。java:136)失败:parseexception行1:45无法识别列名或中“日期”“字符串”“)”附近的输入主键或外键。
我能够在ubuntu上成功运行相同的查询。在hive2中,coulmn名称必须用“in”括起来吗?
1条答案
按热度按时间yiytaume1#
date
是保留字,应该是限定字。您使用了错误的限定符。你应该使用
'
而不是‘
或者’
.你的位置开头有空格
/hive/data...
```CREATE EXTERNAL TABLE weatherext (wban INT,
date
STRING)ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LOCATION '/hive/data/weatherext';