我正在尝试将记录插入到我创建的表中。但是它失败,并显示FailedPredicateException(
我尝试对select语句使用别名,然后在sql中使用列名,但由于相同的错误而失败。可能是什么问题?
create table sales_log(
trxn_uuid string,
unit_sold int,
unihprice decimal(13,4),
event_ts timestamp
)
stored as orc
location '/user/me/sales/sales_log';
insert into sales_log select 'axxx1', 2, 8,cast('2018-01-01 06:34:56.789' as timestamp);
hive> insert into sales_log select 'axxx1', 2, 8,cast('2018-01-01 06:34:56.789' as timestamp);
FailedPredicateException(regularBody,{$s.tree.getChild(1) !=null}?)
at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:43166)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:42341)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:42211)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1681)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1152)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:211)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:171)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:438)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:321)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1224)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1265)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1161)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1151)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:217)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:169)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:380)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:740)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:685)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:233)
at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
FAILED: ParseException line 1:87 Failed to recognize predicate '<EOF>'. Failed rule: 'regularBody' in statement
答案 0 :(得分:1)
已知问题,已在Hive 1.3.1 / 2.0中修复。
在早期版本中,如果没有insert as select
子句,则不能使用from
。使用插入into ... values ...
重写查询或升级到最新的Hive版本。