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

JDBC driver assumes executeStatement is synchronous

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.11.0
    • 0.12.0
    • JDBC
    • None

    Description

      The JDBC driver seems to assume that ExecuteStatement is a synchronous call when performing updates via executeUpdate, where the following comment on the RPC in the Thrift file indicates otherwise:

      // ExecuteStatement()
      //
      // Execute a statement.
      // The returned OperationHandle can be used to check on the
      // status of the statement, and to fetch results once the
      // statement has finished executing.
      

      I understand that Hive's implementation of ExecuteStatement is blocking (see https://issues.apache.org/jira/browse/HIVE-4569), but presumably other implementations of the HiveServer2 API (and I'm talking specifically about Impala here, but others might have a similar concern) should be free to return a pollable OperationHandle per the specification.

      The JDBC driver's executeUpdate is as follows:

      public int executeUpdate(String sql) throws SQLException {
          execute(sql);
          return 0;
        }
      

      execute(sql) discards the OperationHandle that it gets from the server after determining whether there are results to be fetched.

      This is problematic for us, because Impala will cancel queries that are running when a session executes, but there's no easy way to be sure that an INSERT statement has completed before terminating a session on the client.

      Attachments

        1. HIVE-5060.patch
          3 kB
          Brock Noland
        2. 0001-HIVE-5060-JDBC-driver-assumes-executeStatement-is-sy.patch
          3 kB
          Henry Robinson

        Issue Links

          Activity

            People

              henryr Henry Robinson
              henryr Henry Robinson
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: