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

Fix jdbc connection hiveserver2 using dfs command with prefix space will cause exception

    XMLWordPrintableJSON

Details

    Description

              Connection con = DriverManager.getConnection("jdbc:hive2://10.214.35.115:10000/");
              Statement stmt = con.createStatement();
              // dfs command with prefix space or "\n"
              ResultSet res = stmt.executeQuery(" dfs -ls /");
              //ResultSet res = stmt.executeQuery("\ndfs -ls /"); 

      it will cause exception

      Exception in thread "main" org.apache.hive.service.cli.HiveSQLException: Error while processing statement: null
          at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:231)
          at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:217)
          at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:244)
          at org.apache.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:375)
          at com.ne.gdc.whitemane.shezm.TestJdbc.main(TestJdbc.java:30)
      Caused by: org.apache.hive.service.cli.HiveSQLException: Error while processing statement: null
          at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:380)
          at org.apache.hive.service.cli.operation.HiveCommandOperation.runInternal(HiveCommandOperation.java:118)
          at org.apache.hive.service.cli.operation.Operation.run(Operation.java:320)
          at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:530)
          at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:517)
          at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
          at org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
          at org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:63)
          at java.security.AccessController.doPrivileged(Native Method)
          at javax.security.auth.Subject.doAs(Subject.java:422)
          at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730)
          at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:59)
          at com.sun.proxy.$Proxy43.executeStatementAsync(Unknown Source)
          at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:310)
          at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:530)
          at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1437)
          at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1422)
          at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
          at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
          at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge$Server$TUGIAssumingProcessor.process(HadoopThriftAuthBridge.java:605)
          at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
       

      But when I execute sql with prefix "\n" it works fine

      ResultSet res = stmt.executeQuery("\n select 1"); 

      Attachments

        Issue Links

          Activity

            People

              Zing zzzzming95
              Zing zzzzming95
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h
                  2h