Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-16695

beeline throws ArrayIndexOutOfBoundsException sourcing multiple multi-line queries

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • Beeline
    • None

    Description

      If you source multiple multi-line queries back-to-back, beeline crashes.

      This reproduces with version 3.0.0-SNAPSHOT re97734b1ca010d9690bbb0d6bdddf92082a20688

      If the sourced query is only 1 line rather than >1 line, there is no crash.

      Consider this query:

      [vagrant@trunk queries]$ cat repro.sql
      select 1,
      2;
      

      Here is a session that shows the problem in action:

      [vagrant@trunk queries]$ beeline -u jdbc:hive2://localhost:10000/default --verbose=true
      SLF4J: Class path contains multiple SLF4J bindings.
      SLF4J: Found binding in [jar:file:/usr/hdp/2.6.1.0-78/hive2/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: Found binding in [jar:file:/usr/hdp/2.6.1.0-78/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
      SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
      issuing: !connect jdbc:hive2://localhost:10000/default '' [passwd stripped]
      Connecting to jdbc:hive2://localhost:10000/default
      Connected to: Apache Hive (version 3.0.0-SNAPSHOT)
      Driver: Hive JDBC (version 2.1.0.2.6.1.0-78)
      Transaction isolation: TRANSACTION_REPEATABLE_READ
      Beeline version 2.1.0.2.6.1.0-78 by Apache Hive
      0: jdbc:hive2://localhost:10000/default> select version();
      going to print operations logs
      printed operations logs
      Getting log thread is interrupted, since query is done!
      INFO  : Compiling command(queryId=hive_20170517150532_10b373f0-a4d9-4ce4-b61e-c899dc6e2b86): select version()
      INFO  : Semantic Analysis Completed
      INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:_c0, type:string, comment:null)], properties:null)
      INFO  : Completed compiling command(queryId=hive_20170517150532_10b373f0-a4d9-4ce4-b61e-c899dc6e2b86); Time taken: 0.036 seconds
      INFO  : Executing command(queryId=hive_20170517150532_10b373f0-a4d9-4ce4-b61e-c899dc6e2b86): select version()
      INFO  : Completed executing command(queryId=hive_20170517150532_10b373f0-a4d9-4ce4-b61e-c899dc6e2b86); Time taken: 0.002 seconds
      INFO  : OK
      +-----------------------------------------------------------+--+
      |                            _c0                            |
      +-----------------------------------------------------------+--+
      | 3.0.0-SNAPSHOT re97734b1ca010d9690bbb0d6bdddf92082a20688  |
      +-----------------------------------------------------------+--+
      1 row selected (0.163 seconds)
      0: jdbc:hive2://localhost:10000/default> source repro.sql;
      going to print operations logs
      printed operations logs
      Getting log thread is interrupted, since query is done!
      INFO  : Compiling command(queryId=hive_20170517150535_c707de54-9540-4dc2-816e-6e1e491dc591): select 1,
      2
      INFO  : Semantic Analysis Completed
      INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:_c0, type:int, comment:null), FieldSchema(name:_c1, type:int, comment:null)], properties:null)
      INFO  : Completed compiling command(queryId=hive_20170517150535_c707de54-9540-4dc2-816e-6e1e491dc591); Time taken: 0.432 seconds
      INFO  : Executing command(queryId=hive_20170517150535_c707de54-9540-4dc2-816e-6e1e491dc591): select 1,
      2
      INFO  : Completed executing command(queryId=hive_20170517150535_c707de54-9540-4dc2-816e-6e1e491dc591); Time taken: 0.001 seconds
      INFO  : OK
      +------+------+--+
      | _c0  | _c1  |
      +------+------+--+
      | 1    | 2    |
      +------+------+--+
      1 row selected (0.473 seconds)
      0: jdbc:hive2://localhost:10000/default> source repro.sql;
      java.lang.ArrayIndexOutOfBoundsException: 1
      	at org.apache.hive.beeline.Commands.addConf(Commands.java:827)
      	at org.apache.hive.beeline.Commands.getHiveConfHelper(Commands.java:773)
      	at org.apache.hive.beeline.Commands.getHiveConf(Commands.java:765)
      	at org.apache.hive.beeline.Commands.sourceFile(Commands.java:853)
      	at org.apache.hive.beeline.Commands.executeInternal(Commands.java:933)
      	at org.apache.hive.beeline.Commands.execute(Commands.java:1161)
      	at org.apache.hive.beeline.Commands.sql(Commands.java:1076)
      	at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:1145)
      	at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:976)
      	at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:886)
      	at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:502)
      	at org.apache.hive.beeline.BeeLine.main(BeeLine.java:485)
      	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:233)
      	at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
      Closing: 0: jdbc:hive2://localhost:10000/default
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cartershanklin Carter Shanklin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: