Hive
  1. Hive
  2. HIVE-6050

Newer versions of JDBC driver does not work with older HiveServer2

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Blocker Blocker
    • Resolution: Unresolved
    • Affects Version/s: 0.13.0
    • Fix Version/s: None
    • Component/s: HiveServer2, JDBC
    • Labels:
      None

      Description

      HiveServer2 instance has to be upgraded before the JDBC drivers used by applications are upgraded. If jdbc drivers are updated before HiveServer2 is upgraded it will not be functional.

      Connect from JDBC driver of Hive 0.13 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

      java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
      	at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
      	at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
      	at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
      	at java.sql.DriverManager.getConnection(DriverManager.java:571)
      	at java.sql.DriverManager.getConnection(DriverManager.java:187)
      	at org.apache.hive.jdbc.MyTestJdbcDriver2.getConnection(MyTestJdbcDriver2.java:73)
      	at org.apache.hive.jdbc.MyTestJdbcDriver2.&lt;init&gt;(MyTestJdbcDriver2.java:49)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:187)
      	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:523)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1063)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:914)
      Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
      	at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
      	at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
      	at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
      	at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
      	at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
      	... 37 more
      

      On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the code path in the generated file 'TOpenSessionReq.java', method TOpenSessionReqStandardScheme.read():

      1. The method will call 'TProtocolVersion.findValue()' on the thrift protocol's byte stream, which returns null if the client is sending an enum value unknown to the server. (v4 is unknown to server)
      2. The method will then call struct.validate(), which will throw the above exception because of null version.

      So doesn't look like the current backward-compatibility scheme will work.

        Issue Links

          Activity

          Thejas M Nair made changes -
          Description Connect from JDBC driver of Hive 0.13 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

          {noformat}
          java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
          at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
          at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
          at java.sql.DriverManager.getConnection(DriverManager.java:571)
          at java.sql.DriverManager.getConnection(DriverManager.java:187)
          at org.apache.hive.jdbc.MyTestJdbcDriver2.getConnection(MyTestJdbcDriver2.java:73)
          at org.apache.hive.jdbc.MyTestJdbcDriver2.&lt;init&gt;(MyTestJdbcDriver2.java:49)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
          at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:187)
          at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
          at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:523)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1063)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:914)
          Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
          at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
          ... 37 more
          {noformat}

          On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the code path in the generated file 'TOpenSessionReq.java', method TOpenSessionReqStandardScheme.read():

          1. The method will call 'TProtocolVersion.findValue()' on the thrift protocol's byte stream, which returns null if the client is sending an enum value unknown to the server. (v4 is unknown to server)
          2. The method will then call struct.validate(), which will throw the above exception because of null version.

          So doesn't look like the current backward-compatibility scheme will work.
          HiveServer2 instance has to be upgraded before the JDBC drivers used by applications are upgraded. If jdbc drivers are updated before HiveServer2 is upgraded it will not be functional.

          Connect from JDBC driver of Hive 0.13 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

          {noformat}
          java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
          at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
          at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
          at java.sql.DriverManager.getConnection(DriverManager.java:571)
          at java.sql.DriverManager.getConnection(DriverManager.java:187)
          at org.apache.hive.jdbc.MyTestJdbcDriver2.getConnection(MyTestJdbcDriver2.java:73)
          at org.apache.hive.jdbc.MyTestJdbcDriver2.&lt;init&gt;(MyTestJdbcDriver2.java:49)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
          at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:187)
          at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
          at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:523)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1063)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:914)
          Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
          at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
          ... 37 more
          {noformat}

          On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the code path in the generated file 'TOpenSessionReq.java', method TOpenSessionReqStandardScheme.read():

          1. The method will call 'TProtocolVersion.findValue()' on the thrift protocol's byte stream, which returns null if the client is sending an enum value unknown to the server. (v4 is unknown to server)
          2. The method will then call struct.validate(), which will throw the above exception because of null version.

          So doesn't look like the current backward-compatibility scheme will work.
          Thejas M Nair made changes -
          Summary HiveServer2 JDBC backward compatibility is broken Newer versions of JDBC driver does not work with older HiveServer2
          Carl Steinbach made changes -
          Summary JDBC backward compatibility is broken HiveServer2 JDBC backward compatibility is broken
          Carl Steinbach made changes -
          Assignee Carl Steinbach [ cwsteinbach ]
          George Chow made changes -
          Link This issue relates to HIVE-6160 [ HIVE-6160 ]
          Szehon Ho made changes -
          Affects Version/s 0.13.0 [ 12324986 ]
          Affects Version/s 0.12.0 [ 12324312 ]
          Szehon Ho made changes -
          Affects Version/s 0.12.0 [ 12324312 ]
          Carl Steinbach made changes -
          Assignee Carl Steinbach [ cwsteinbach ]
          Carl Steinbach made changes -
          Component/s HiveServer2 [ 12320408 ]
          Brock Noland made changes -
          Priority Major [ 3 ] Blocker [ 1 ]
          Szehon Ho made changes -
          Description Connect from JDBC driver of Hive 0.13 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

          {noformat}
          java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
          at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
          at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
          at java.sql.DriverManager.getConnection(DriverManager.java:571)
          at java.sql.DriverManager.getConnection(DriverManager.java:187)
          at com.cloudera.itest.hiveserver.UnmanagedHiveServer.createConnection(UnmanagedHiveServer.java:73)
          at com.cloudera.itest.AbstractTestWithStaticConfiguration.createConnection(AbstractTestWithStaticConfiguration.java:68)
          at com.cloudera.itest.FirstTest.sanityConnectionTest(FirstTest.java:19)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
          at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
          at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
          at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
          Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
          at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
          ... 37 more
          {noformat}

          On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the code path in the generated file 'TOpenSessionReq.java', method TOpenSessionReqStandardScheme.read():

          1. The method will call 'TProtocolVersion.findValue()' on the thrift protocol's byte stream, which returns null if the client is sending an enum value unknown to the server. (v4 is unknown to server)
          2. The method will then call struct.validate(), which will throw the above exception because of null version.

          So doesn't look like the current backward-compatibility scheme will work.
          Connect from JDBC driver of Hive 0.13 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

          {noformat}
          java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
          at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
          at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
          at java.sql.DriverManager.getConnection(DriverManager.java:571)
          at java.sql.DriverManager.getConnection(DriverManager.java:187)
          at org.apache.hive.jdbc.MyTestJdbcDriver2.getConnection(MyTestJdbcDriver2.java:73)
          at org.apache.hive.jdbc.MyTestJdbcDriver2.&lt;init&gt;(MyTestJdbcDriver2.java:49)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
          at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:187)
          at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
          at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:523)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1063)
          at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:914)
          Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
          at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
          ... 37 more
          {noformat}

          On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the code path in the generated file 'TOpenSessionReq.java', method TOpenSessionReqStandardScheme.read():

          1. The method will call 'TProtocolVersion.findValue()' on the thrift protocol's byte stream, which returns null if the client is sending an enum value unknown to the server. (v4 is unknown to server)
          2. The method will then call struct.validate(), which will throw the above exception because of null version.

          So doesn't look like the current backward-compatibility scheme will work.
          Szehon Ho made changes -
          Description Connect from JDBC driver of Hive 0.12 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

          {noformat}
          java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
          at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
          at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
          at java.sql.DriverManager.getConnection(DriverManager.java:571)
          at java.sql.DriverManager.getConnection(DriverManager.java:187)
          at com.cloudera.itest.hiveserver.UnmanagedHiveServer.createConnection(UnmanagedHiveServer.java:73)
          at com.cloudera.itest.AbstractTestWithStaticConfiguration.createConnection(AbstractTestWithStaticConfiguration.java:68)
          at com.cloudera.itest.FirstTest.sanityConnectionTest(FirstTest.java:19)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
          at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
          at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
          at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
          Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
          at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
          ... 37 more
          {noformat}

          On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the code path in the generated file 'TOpenSessionReq.java', method TOpenSessionReqStandardScheme.read():

          1. The method will call 'TProtocolVersion.findValue()' on the thrift protocol's byte stream, which returns null if the client is sending an enum value unknown to the server. (v4 is unknown to server)
          2. The method will then call struct.validate(), which will throw the above exception because of null version.

          So doesn't look like the current backward-compatibility scheme will work.
          Connect from JDBC driver of Hive 0.13 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

          {noformat}
          java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
          at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
          at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
          at java.sql.DriverManager.getConnection(DriverManager.java:571)
          at java.sql.DriverManager.getConnection(DriverManager.java:187)
          at com.cloudera.itest.hiveserver.UnmanagedHiveServer.createConnection(UnmanagedHiveServer.java:73)
          at com.cloudera.itest.AbstractTestWithStaticConfiguration.createConnection(AbstractTestWithStaticConfiguration.java:68)
          at com.cloudera.itest.FirstTest.sanityConnectionTest(FirstTest.java:19)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
          at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
          at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
          at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
          Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
          at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
          ... 37 more
          {noformat}

          On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the code path in the generated file 'TOpenSessionReq.java', method TOpenSessionReqStandardScheme.read():

          1. The method will call 'TProtocolVersion.findValue()' on the thrift protocol's byte stream, which returns null if the client is sending an enum value unknown to the server. (v4 is unknown to server)
          2. The method will then call struct.validate(), which will throw the above exception because of null version.

          So doesn't look like the current backward-compatibility scheme will work.
          Szehon Ho made changes -
          Field Original Value New Value
          Description Connect from JDBC driver of Hive 0.12 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

          {noformat}
          java.sql.SQLException: Could not establish connection to jdbc:hive2://hive-c5-mysql-1.ent.cloudera.com:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
          at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
          at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
          at java.sql.DriverManager.getConnection(DriverManager.java:571)
          at java.sql.DriverManager.getConnection(DriverManager.java:187)
          at com.cloudera.itest.hiveserver.UnmanagedHiveServer.createConnection(UnmanagedHiveServer.java:73)
          at com.cloudera.itest.AbstractTestWithStaticConfiguration.createConnection(AbstractTestWithStaticConfiguration.java:68)
          at com.cloudera.itest.FirstTest.sanityConnectionTest(FirstTest.java:19)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
          at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
          at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
          at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
          Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
          at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
          ... 37 more
          {noformat}

          On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the generated file 'TOpenSessionReq.java', the method TOpenSessionReqStandardScheme.read(). The method will call 'TProtocolVersion.findValue() on the thrift protocol's bytes, which returns null if the client is sending an enum value unknown to the server. Then struct.validate() at the end of the method will fail because protocol version is null. So doesn't look like the current backward-compatibility scheme will work.
          Connect from JDBC driver of Hive 0.12 (TProtocolVersion=v4) to HiveServer2 of Hive 0.10 (TProtocolVersion=v1), will return the following exception:

          {noformat}
          java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:336)
          at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:158)
          at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
          at java.sql.DriverManager.getConnection(DriverManager.java:571)
          at java.sql.DriverManager.getConnection(DriverManager.java:187)
          at com.cloudera.itest.hiveserver.UnmanagedHiveServer.createConnection(UnmanagedHiveServer.java:73)
          at com.cloudera.itest.AbstractTestWithStaticConfiguration.createConnection(AbstractTestWithStaticConfiguration.java:68)
          at com.cloudera.itest.FirstTest.sanityConnectionTest(FirstTest.java:19)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
          at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
          at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
          at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
          Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null)
          at org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
          at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:160)
          at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:147)
          at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:327)
          ... 37 more
          {noformat}

          On code analysis, it looks like the 'client_protocol' scheme is a ThriftEnum, which doesn't seem to be backward-compatible. Look at the code path in the generated file 'TOpenSessionReq.java', method TOpenSessionReqStandardScheme.read():

          1. The method will call 'TProtocolVersion.findValue()' on the thrift protocol's byte stream, which returns null if the client is sending an enum value unknown to the server. (v4 is unknown to server)
          2. The method will then call struct.validate(), which will throw the above exception because of null version.

          So doesn't look like the current backward-compatibility scheme will work.
          Szehon Ho created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Szehon Ho
            • Votes:
              5 Vote for this issue
              Watchers:
              22 Start watching this issue

              Dates

              • Created:
                Updated:

                Development