为什么在Hive中插入记录失败,并显示FailedPredicateException? [英] why does inserting record into hive fails with FailedPredicateException?

查看:615
本文介绍了为什么在Hive中插入记录失败,并显示FailedPredicateException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将记录插入到我创建的表中.但是它失败,并显示FailedPredicateException(

I'm trying to insert record into a table I created. But it fails with FailedPredicateException(

我尝试对select语句使用别名,然后在sql中使用列名,但由于相同的错误而失败.可能是什么问题?

I tried using alias for select statement, and then column names in sql, yet it fails with same error. What could be the issue?

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

推荐答案

已知问题,已在Hive 1.3.1/2.0中修复.

Known issue, fixed in Hive 1.3.1/2.0.

在早期版本中,如果没有 from 子句,则不能使用 insert作为select .使用insert into ... values ... 重写查询或升级到最新的Hive版本.

You can’t use insert as select without from clause in earlier versions. Rewrite your query using insert into ... values ... or upgrade to latest Hive version.

这篇关于为什么在Hive中插入记录失败,并显示FailedPredicateException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆