运行apache配置单元时发现Parse Error- NoViableAltException

时间:2016-06-13 14:02:32

标签: hive

WITH query1 AS (
   SELECT g.ccc, g.nnn, g.ttt, g.aaa
   FROM table1 g
   WHERE g.aaa BETWEEN '3000' AND '3999'
   AND g.ccc NOT IN('05','06') 
   AND g.nnn = '1369'
),
query2 AS (
   SELECT g.ccc, g.nnn, g.ttt, g.aaa
   FROM table1 g
   WHERE g.aaa BETWEEN '1544' AND '1567'
   AND g.ccc NOT IN('05','06') 
   AND g.nnn = '1369'
)
SELECT * FROM query1
WHERE ccc IN ( SELECT ccc FROM query2 )
UNION ALL
SELECT * FROM query2
WHERE ccc IN ( SELECT ccc FROM query1 )

以上是我的.hql脚本中的代码。当我运行脚本时出现上述错误,请你帮我解决这个问题。 在下面的博客中找到了同样的问题,但没有帮助解决我的问题。 Hive ParseException - cannot recognize input near 'end' 'string'

没有这个逻辑,脚本工作正常。

NoViableAltException(26@[])
        at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1074)
        at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
        at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:396)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:308)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1122)
        at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1170)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1059)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1049)
        at `enter code here`org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:213)
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:165)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:376)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:311)
        at org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:409)
        at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:425)
        at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:714)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
        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:497)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
FAILED: ParseException line 3:0 cannot recognize input near 'MERGE' 'INTO' 'scrap_data'

Getting the above exception. in order to resolve the same issue, i have fallowed 
https://stackoverflow.com/questions/18640760/hive-parseexception-cannot-recognize-input-near-end-string

As per this blog. i made the changes but did not work for me.
Help me with this issue. `enter code here`
CREATE TABLE IF NOT EXISTS tbALPartNr(
pn_id int,
category int,
pn varchar(30),
price decimal(18, 8),
pn_desc varchar(500),
scrap_limit smallint,
scrap_percent decimal(18, 0),
price_limit decimal(18, 8),
plant_name varchar(250)
)
MERGE INTO scrap_data.tbALPartNr t
USING(SELECT distinct[scrap_data.tbALPartNr.pn],
count([scrap_data.tbALPartNr.plant_name])as plants
FROM scrap_data.tbALPartNr group by [scrap_data.tbALPartNr.pn]) s
ON (t.scrap_data.tbALPartNr.pn=s.scrap_data.tbALPartNr.pn)
WHEN MATCHED THEN
UPDATE SET t.category=s.plants;

对此有任何帮助。

1 个答案:

答案 0 :(得分:0)

此问题尚未解决:issues.apache.org/jira/browse/HIVE-10924配置单元中不存在当前功能。