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

Yongzhi Chen commented on HIVE-14538:
-------------------------------------

The bug is introduced by support of variable substitution.
There are some issues:
1. Variable substitution is not supported in beeline, so the problematic code 
could be avoided and the performance can be better.
2.  The NPE is caused by the code assume there is a valid connection between 
client and server
3.  ArrayIndexOutOfBoundsException is caused by unexpected value. Boundary 
check is needed.

Attach patch to solve up issues.

> beeline throws exceptions with parsing hive config when using !sh statement
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-14538
>                 URL: https://issues.apache.org/jira/browse/HIVE-14538
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>            Reporter: Yongzhi Chen
>            Assignee: Yongzhi Chen
>         Attachments: HIVE-14538.1.patch
>
>
> When beeline has a connection to a server, in some env it has following 
> problem:
> {noformat}
> 0: jdbc:hive2://localhost> !verbose
> verbose: on
> 0: jdbc:hive2://localhost> !sh id
> java.lang.ArrayIndexOutOfBoundsException: 1
> at org.apache.hive.beeline.Commands.addConf(Commands.java:758)
> at org.apache.hive.beeline.Commands.getHiveConf(Commands.java:704)
> at org.apache.hive.beeline.Commands.sh(Commands.java:1002)
> 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.hive.beeline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:52)
> at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:1081)
> at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:917)
> at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:845)
> at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:482)
> at org.apache.hive.beeline.BeeLine.main(BeeLine.java:465)
> 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:221)
> at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
> 0: jdbc:hive2://localhost> !sh echo hello
> java.lang.ArrayIndexOutOfBoundsException: 1
> at org.apache.hive.beeline.Commands.addConf(Commands.java:758)
> at org.apache.hive.beeline.Commands.getHiveConf(Commands.java:704)
> at org.apache.hive.beeline.Commands.sh(Commands.java:1002)
> 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.hive.beeline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:52)
> at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:1081)
> at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:917)
> at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:845)
> at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:482)
> at org.apache.hive.beeline.BeeLine.main(BeeLine.java:465)
> 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:221)
> at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
> 0: jdbc:hive2://localhost>
> {noformat}
> Also it breaks if there is no connection established:
> {noformat}
> beeline> !sh id
> java.lang.NullPointerException
> at org.apache.hive.beeline.BeeLine.createStatement(BeeLine.java:1897)
> at org.apache.hive.beeline.Commands.getConfInternal(Commands.java:724)
> at org.apache.hive.beeline.Commands.getHiveConf(Commands.java:702)
> at org.apache.hive.beeline.Commands.sh(Commands.java:1002)
> 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.hive.beeline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:52)
> at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:1081)
> at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:917)
> at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:845)
> at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:482)
> at org.apache.hive.beeline.BeeLine.main(BeeLine.java:465)
> 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:221)
> at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
> {noformat}



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

Reply via email to