hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sanjiv singh (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HIVE-10342) Nested parenthesis for derived table in from clause - is not working
Date Wed, 15 Apr 2015 14:03:58 GMT
sanjiv singh created HIVE-10342:
-----------------------------------

             Summary: Nested parenthesis for derived table in from clause -  is not working
                 Key: HIVE-10342
                 URL: https://issues.apache.org/jira/browse/HIVE-10342
             Project: Hive
          Issue Type: Bug
          Components: Parser, SQL
    Affects Versions: 1.0.0
            Reporter: sanjiv singh


Hi All,

Nested parenthesis for derived table in from clause, is not working.

See the given query with derived table , and worling perfectly in hive.

select count(*) 
from (select distinct em_last_name, em_first_name, em_d_date
       from employee
       UNION ALL
      select distinct cu_last_name, cu_first_name, cu_d_date
       from customer
       UNION ALL
      select distinct cl_last_name, cl_first_name, cl_d_date
       from client
) cool_cust;

When I added additional parenthesis enclosing derived table , it failed in parsing. ...It
seems HIVE ANTLR grammar is not compatible to such  syntax. 

Failed Query :
###############

select count(*) 
from ((select distinct em_last_name, em_first_name, em_d_date
       from employee)
       UNION ALL
      (select distinct cu_last_name, cu_first_name, cu_d_date
       from customer)
       UNION ALL
      (select distinct cl_last_name, cl_first_name, cl_d_date
       from client)
) cool_cust;

Exception  :
##############

oViableAltException(283@[147:5: ( ( Identifier LPAREN )=> partitionedTableFunction | tableSource
| subQuerySource | virtualTableSource )])
	at org.antlr.runtime.DFA.noViableAlt(DFA.java:158)
	at org.antlr.runtime.DFA.predict(DFA.java:144)
	at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.fromSource(HiveParser_FromClauseParser.java:3625)
	at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.joinSource(HiveParser_FromClauseParser.java:1814)
	at org.apache.hadoop.hive.ql.parse.HiveParser_FromClauseParser.fromClause(HiveParser_FromClauseParser.java:1471)
	at org.apache.hadoop.hive.ql.parse.HiveParser.fromClause(HiveParser.java:42804)
	at org.apache.hadoop.hive.ql.parse.HiveParser.singleSelectStatement(HiveParser.java:40229)
	at org.apache.hadoop.hive.ql.parse.HiveParser.selectStatement(HiveParser.java:39914)
	at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:39851)
	at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:38904)
	at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:38780)
	at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1514)
	at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1052)
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:199)
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:389)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:303)
	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1067)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1129)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:201)
	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:153)
	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:364)
	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:712)
	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:631)
	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:570)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
FAILED: ParseException line 1:41 cannot recognize input near '(' '(' 'SELECT' in from source




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message