hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julien Letrouit (JIRA)" <>
Subject [jira] [Created] (HIVE-5089) Non query PreparedStatements are always failing on remote HiveServer2
Date Wed, 14 Aug 2013 15:27:47 GMT
Julien Letrouit created HIVE-5089:

             Summary: Non query PreparedStatements are always failing on remote HiveServer2
                 Key: HIVE-5089
             Project: Hive
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 0.11.0
            Reporter: Julien Letrouit

This is reproducing the issue systematically:

import org.apache.hive.jdbc.HiveDriver;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Main {
  public static void main(String[] args) throws Exception {
    DriverManager.registerDriver(new HiveDriver());
    Connection conn = DriverManager.getConnection("jdbc:hive2://someserver");
    PreparedStatement smt = conn.prepareStatement("SET hivevar:test=1");
    smt.execute(); // Exception here

It is producing the following stacktrace:

Exception in thread "main" java.sql.SQLException: Could not create ResultSet: null
  at org.apache.hive.jdbc.HiveQueryResultSet.retrieveSchema(
  at org.apache.hive.jdbc.HiveQueryResultSet.<init>(
  at org.apache.hive.jdbc.HiveQueryResultSet$
  at org.apache.hive.jdbc.HivePreparedStatement.executeImmediate(
  at org.apache.hive.jdbc.HivePreparedStatement.execute(
  at Main.main(
Caused by: org.apache.thrift.transport.TTransportException
  at org.apache.thrift.transport.TTransport.readAll(
  at org.apache.thrift.transport.TSaslTransport.readLength(
  at org.apache.thrift.transport.TSaslTransport.readFrame(
  at org.apache.thrift.transport.TTransport.readAll(
  at org.apache.thrift.protocol.TBinaryProtocol.readAll(
  at org.apache.thrift.protocol.TBinaryProtocol.readI32(
  at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(
  at org.apache.thrift.TServiceClient.receiveBase(
  at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_GetResultSetMetadata(
  at org.apache.hive.service.cli.thrift.TCLIService$Client.GetResultSetMetadata(
  at org.apache.hive.jdbc.HiveQueryResultSet.retrieveSchema(
  ... 5 more

I tried to fix it, unfortunately, the standalone server used in unit tests do not reproduce
the issue. The following test added to TestJdbcDriver2 is passing:

  public void testNonQueryPrepareStatement() throws Exception {
    try {
      PreparedStatement ps = con.prepareStatement("SET hivevar:test=1");
      boolean hasResultSet = ps.execute();
    } catch (Exception e) {

Any guidance on how to reproduce it in tests would be appreciated.

Impact: the data analysis tools we are using are performing PreparedStatements. The use of
custom UDF is forcing us to add 'ADD JAR ...' and 'CREATE TEMPORARY FUNCTION ...' statement
to our query. Those statements are failing when executed as PreparedStatements.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message