[ https://issues.apache.org/jira/browse/HIVE-9113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14248235#comment-14248235 ]
Prabhu Joseph commented on HIVE-9113: ------------------------------------- Hi Chao, The subquery inside IN clause does not have from clause. The correct query is below, {noformat} select p.p_partkey, li.suppkey from (select distinct partkey as p_partkey from lineitem) p join lineitem li on p.p_partkey = li.partkey where li.l_linenumber = 1 and li.l_orderkey in (select l_orderkey from lineitem where l_linenumber = li.l_linenumber); {noformat} > Explain on query failed with NPE > -------------------------------- > > Key: HIVE-9113 > URL: https://issues.apache.org/jira/browse/HIVE-9113 > Project: Hive > Issue Type: Bug > Components: Query Processor > Reporter: Chao > > Run explain on the following query: > {noformat} > select p.p_partkey, li.l_suppkey > from (select distinct l_partkey as p_partkey from lineitem) p join lineitem > li on p.p_partkey = li.l_partkey > where li.l_linenumber = 1 and > li.l_orderkey in (select l_orderkey where l_linenumber = li.l_linenumber) > ; > {noformat} > gave me NPE: > {noformat} > java.lang.NullPointerException > at > org.apache.hadoop.hive.ql.parse.QBSubQuery.validateAndRewriteAST(QBSubQuery.java:516) > at > org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genFilterPlan(SemanticAnalyzer.java:2605) > at > org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genBodyPlan(SemanticAnalyzer.java:8866) > at > org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9745) > at > org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9638) > at > org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10125) > at > org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:221) > at > org.apache.hadoop.hive.ql.parse.ExplainSemanticAnalyzer.analyzeInternal(ExplainSemanticAnalyzer.java:74) > at > org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:221) > at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:420) > at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:306) > at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1108) > at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1170) > at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1045) > at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1035) > at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:199) > at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:151) > at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:362) > at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:720) > at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:639) > at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:578) > 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.main(RunJar.java:212) > {noformat} > Is this query invalid? If so, it should at least give some explanations, not > just a plain NPE message, and left user clueless. -- This message was sent by Atlassian JIRA (v6.3.4#6332)