[ 
https://issues.apache.org/jira/browse/HIVE-9923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14496451#comment-14496451
 ] 

Yongzhi Chen commented on HIVE-9923:
------------------------------------

The NullPointerException stack is:
{noformat}
Caused by: java.lang.NullPointerException
        at 
org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:40882)
        at 
org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:40059)
        at 
org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:39929)
        at 
org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1574)
        at 
org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1093)
        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.compileAndRespond(Driver.java:1116)
        at 
org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:110)
        ... 27 more

{noformat}
It is from HiveParser.java:
{noformat}
                           if ( state.backtracking==0 ) 
{(s!=null?((CommonTree)s.tree):null).getChild(1).replaceChildren(0, 0, 
(i!=null?((CommonTree)i.tree):null));}
{noformat}
Where there is no from key word, the getChild(1) will be null, then the 
exception thrown.
When insert with select statement, a "from" should be required not optional. 
Make the parser change to let it error out before reach getChild(1). 


> No clear message when "from" is missing
> ---------------------------------------
>
>                 Key: HIVE-9923
>                 URL: https://issues.apache.org/jira/browse/HIVE-9923
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Jeff Zhang
>            Assignee: Yongzhi Chen
>         Attachments: HIVE-9923.1.patch
>
>
> For the following sql, "from" is missing but it throw NPE which is not clear 
> for user.
> {code}
> hive> insert overwrite directory '/tmp/hive-3' select sb1.name, sb2.age 
> student_bucketed sb1 join student_bucketed sb2 on sb1.name=sb2.name;
> FAILED: NullPointerException null
> {code}



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

Reply via email to