Grokbase Groups Hive commits May 2016
FAQ
Repository: hive
Updated Branches:
   refs/heads/master c6974c228 -> aed350351


HIVE-13882: When hive.server2.async.exec.async.compile is turned on, from JDBC we will get "The query did not generate a result set" (Reviewed by Jimmy Xiang)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/aed35035
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/aed35035
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/aed35035

Branch: refs/heads/master
Commit: aed350351b24125ff6bbf36373b5247070c48d5c
Parents: c6974c2
Author: Aihua Xu <aihuaxu@apache.org>
Authored: Tue Apr 26 14:31:55 2016 -0400
Committer: Aihua Xu <aihuaxu@apache.org>
Committed: Tue May 31 10:40:28 2016 -0400

----------------------------------------------------------------------
  .../org/apache/hadoop/hive/conf/HiveConf.java | 2 +-
  .../apache/hive/jdbc/TestJdbcWithMiniHS2.java | 69 +++++++++++-
  .../org/apache/hive/jdbc/HiveStatement.java | 12 ++-
  service-rpc/if/TCLIService.thrift | 4 +
  .../gen/thrift/gen-cpp/TCLIService_types.cpp | 22 ++++
  .../src/gen/thrift/gen-cpp/TCLIService_types.h | 12 ++-
  .../rpc/thrift/TGetOperationStatusResp.java | 107 ++++++++++++++++++-
  service-rpc/src/gen/thrift/gen-php/Types.php | 23 ++++
  .../src/gen/thrift/gen-py/TCLIService/ttypes.py | 15 ++-
  .../gen/thrift/gen-rb/t_c_l_i_service_types.rb | 4 +-
  .../hive/service/cli/OperationStatus.java | 8 +-
  .../hive/service/cli/operation/Operation.java | 2 +-
  .../service/cli/thrift/ThriftCLIService.java | 1 +
  .../cli/thrift/ThriftCLIServiceClient.java | 2 +-
  14 files changed, 264 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 6a404bd..cdff4db 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2082,7 +2082,7 @@ public class HiveConf extends Configuration {
      HIVE_SERVER2_THRIFT_BIND_HOST("hive.server2.thrift.bind.host", "",
          "Bind host on which to run the HiveServer2 Thrift service."),
      HIVE_SERVER2_PARALLEL_COMPILATION("hive.driver.parallel.compilation", false, "Whether to\n" +
- "enable parallel compilation between sessions on HiveServer2. The default is false."),
+ "enable parallel compilation of the queries between sessions and within the same session on HiveServer2. The default is false."),
      HIVE_SERVER2_COMPILE_LOCK_TIMEOUT("hive.server2.compile.lock.timeout", "0s",
          new TimeValidator(TimeUnit.SECONDS),
          "Number of seconds a request will wait to acquire the compile lock before giving up. " +

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java
index a01daa4..0c313a2 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java
@@ -50,6 +50,7 @@ import java.util.concurrent.TimeoutException;

  import com.google.common.cache.Cache;
  import com.google.common.cache.CacheBuilder;
+
  import org.apache.commons.lang.StringUtils;
  import org.apache.hadoop.fs.FileSystem;
  import org.apache.hadoop.fs.Path;
@@ -138,6 +139,66 @@ public class TestJdbcWithMiniHS2 {
    }

    @Test
+ public void testParallelCompilation() throws Exception {
+ final String tableName = "testParallelCompilation";
+ hs2Conn = getConnection();
+ Statement stmt = hs2Conn.createStatement();
+
+ // create table
+ stmt.execute("DROP TABLE IF EXISTS " + tableName);
+ stmt.execute("CREATE TABLE " + tableName
+ + " (under_col INT COMMENT 'the under column', value STRING) COMMENT ' test table'");
+
+ // load data
+ stmt.execute("load data local inpath '"
+ + kvDataFilePath.toString() + "' into table " + tableName);
+
+ ResultSet res = stmt.executeQuery("SELECT * FROM " + tableName);
+ assertTrue(res.next());
+ res.close();
+
+ stmt.execute("SET hive.driver.parallel.compilation=true");
+ stmt.execute("SET hive.server2.async.exec.async.compile=true");
+
+ stmt.close();
+
+ startConcurrencyTest(hs2Conn, tableName, 10);
+ Connection conn2 = getConnection();
+ startConcurrencyTest(conn2, tableName, 10);
+ conn2.close();
+ }
+
+ @Test
+ public void testParallelCompilation2() throws Exception {
+ final String tableName = "testParallelCompilation2";
+ hs2Conn = getConnection();
+ Statement stmt = hs2Conn.createStatement();
+
+ // create table
+ stmt.execute("DROP TABLE IF EXISTS " + tableName);
+ stmt.execute("CREATE TABLE " + tableName
+ + " (under_col INT COMMENT 'the under column', value STRING) COMMENT ' test table'");
+
+ // load data
+ stmt.execute("load data local inpath '"
+ + kvDataFilePath.toString() + "' into table " + tableName);
+
+ ResultSet res = stmt.executeQuery("SELECT * FROM " + tableName);
+ assertTrue(res.next());
+ res.close();
+
+ stmt.execute("SET hive.driver.parallel.compilation=false");
+ stmt.execute("SET hive.server2.async.exec.async.compile=true");
+
+ stmt.close();
+
+ startConcurrencyTest(hs2Conn, tableName, 10);
+ Connection conn2 = getConnection();
+ startConcurrencyTest(conn2, tableName, 10);
+ conn2.close();
+ }
+
+ @Test
    public void testConcurrentStatements() throws Exception {
      String tableName = "testConcurrentStatements";
      hs2Conn = getConnection();
@@ -157,9 +218,13 @@ public class TestJdbcWithMiniHS2 {
      res.close();
      stmt.close();

+ startConcurrencyTest(hs2Conn, tableName, 300);
+ }
+
+ private static void startConcurrencyTest(Connection conn, String tableName, int numTasks) {
      // Start concurrent testing
      int POOL_SIZE = 100;
- int TASK_COUNT = 300;
+ int TASK_COUNT = numTasks;

      SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>();
      ExecutorService workers = new ThreadPoolExecutor(1, POOL_SIZE, 20, TimeUnit.SECONDS, executorQueue);
@@ -167,7 +232,7 @@ public class TestJdbcWithMiniHS2 {
      int i = 0;
      while(i < TASK_COUNT) {
        try {
- Future<Boolean> future = workers.submit(new JDBCTask(hs2Conn, i, tableName));
+ Future<Boolean> future = workers.submit(new JDBCTask(conn, i, tableName));
          list.add(future);
          i++;
        } catch (RejectedExecutionException ree) {

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
----------------------------------------------------------------------
diff --git a/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java b/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
index 38ccc78..c4784c3 100644
--- a/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
+++ b/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
@@ -248,10 +248,10 @@ public class HiveStatement implements java.sql.Statement {
    @Override
    public boolean execute(String sql) throws SQLException {
      runAsyncOnServer(sql);
- waitForOperationToComplete();
+ TGetOperationStatusResp status = waitForOperationToComplete();

      // The query should be completed by now
- if (!stmtHandle.isHasResultSet()) {
+ if (!status.isHasResultSet()) {
        return false;
      }
      resultSet = new HiveQueryResultSet.Builder(this).setClient(client).setSessionHandle(sessHandle)
@@ -299,7 +299,7 @@ public class HiveStatement implements java.sql.Statement {
       * Run asynchronously whenever possible
       * Currently only a SQLOperation can be run asynchronously,
       * in a background operation thread
- * Compilation is synchronous and execution is asynchronous
+ * Compilation can run asynchronously or synchronously and execution run asynchronously
       */
      execReq.setRunAsync(true);
      execReq.setConfOverlay(sessConf);
@@ -318,9 +318,9 @@ public class HiveStatement implements java.sql.Statement {
      }
    }

- void waitForOperationToComplete() throws SQLException {
+ TGetOperationStatusResp waitForOperationToComplete() throws SQLException {
      TGetOperationStatusReq statusReq = new TGetOperationStatusReq(stmtHandle);
- TGetOperationStatusResp statusResp;
+ TGetOperationStatusResp statusResp = null;

      // Poll on the operation status, till the operation is complete
      while (!isOperationComplete) {
@@ -363,6 +363,8 @@ public class HiveStatement implements java.sql.Statement {
          throw new SQLException(e.toString(), "08S01", e);
        }
      }
+
+ return statusResp;
    }

    private void checkConnection(String action) throws SQLException {

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service-rpc/if/TCLIService.thrift
----------------------------------------------------------------------
diff --git a/service-rpc/if/TCLIService.thrift b/service-rpc/if/TCLIService.thrift
index 9879b1b..5a9a785 100644
--- a/service-rpc/if/TCLIService.thrift
+++ b/service-rpc/if/TCLIService.thrift
@@ -1037,9 +1037,13 @@ struct TGetOperationStatusResp {

    // When was the operation started
    7: optional i64 operationStarted
+
    // When was the operation completed
    8: optional i64 operationCompleted

+ // If the operation has the result
+ 9: optional bool hasResultSet
+
  }



http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp
----------------------------------------------------------------------
diff --git a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp
index 5229230..0f53cb2 100644
--- a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp
+++ b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp
@@ -8293,6 +8293,11 @@ void TGetOperationStatusResp::__set_operationCompleted(const int64_t val) {
  __isset.operationCompleted = true;
  }

+void TGetOperationStatusResp::__set_hasResultSet(const bool val) {
+ this->hasResultSet = val;
+__isset.hasResultSet = true;
+}
+
  uint32_t TGetOperationStatusResp::read(::apache::thrift::protocol::TProtocol* iprot) {

    apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
@@ -8381,6 +8386,14 @@ uint32_t TGetOperationStatusResp::read(::apache::thrift::protocol::TProtocol* ip
            xfer += iprot->skip(ftype);
          }
          break;
+ case 9:
+ if (ftype == ::apache::thrift::protocol::T_BOOL) {
+ xfer += iprot->readBool(this->hasResultSet);
+ this->__isset.hasResultSet = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
        default:
          xfer += iprot->skip(ftype);
          break;
@@ -8439,6 +8452,11 @@ uint32_t TGetOperationStatusResp::write(::apache::thrift::protocol::TProtocol* o
      xfer += oprot->writeI64(this->operationCompleted);
      xfer += oprot->writeFieldEnd();
    }
+ if (this->__isset.hasResultSet) {
+ xfer += oprot->writeFieldBegin("hasResultSet", ::apache::thrift::protocol::T_BOOL, 9);
+ xfer += oprot->writeBool(this->hasResultSet);
+ xfer += oprot->writeFieldEnd();
+ }
    xfer += oprot->writeFieldStop();
    xfer += oprot->writeStructEnd();
    return xfer;
@@ -8454,6 +8472,7 @@ void swap(TGetOperationStatusResp &a, TGetOperationStatusResp &b) {
    swap(a.taskStatus, b.taskStatus);
    swap(a.operationStarted, b.operationStarted);
    swap(a.operationCompleted, b.operationCompleted);
+ swap(a.hasResultSet, b.hasResultSet);
    swap(a.__isset, b.__isset);
  }

@@ -8466,6 +8485,7 @@ TGetOperationStatusResp::TGetOperationStatusResp(const TGetOperationStatusResp&
    taskStatus = other271.taskStatus;
    operationStarted = other271.operationStarted;
    operationCompleted = other271.operationCompleted;
+ hasResultSet = other271.hasResultSet;
    __isset = other271.__isset;
  }
  TGetOperationStatusResp& TGetOperationStatusResp::operator=(const TGetOperationStatusResp& other272) {
@@ -8477,6 +8497,7 @@ TGetOperationStatusResp& TGetOperationStatusResp::operator=(const TGetOperationS
    taskStatus = other272.taskStatus;
    operationStarted = other272.operationStarted;
    operationCompleted = other272.operationCompleted;
+ hasResultSet = other272.hasResultSet;
    __isset = other272.__isset;
    return *this;
  }
@@ -8491,6 +8512,7 @@ void TGetOperationStatusResp::printTo(std::ostream& out) const {
    out << ", " << "taskStatus="; (__isset.taskStatus ? (out << to_string(taskStatus)) : (out << "<null>"));
    out << ", " << "operationStarted="; (__isset.operationStarted ? (out << to_string(operationStarted)) : (out << "<null>"));
    out << ", " << "operationCompleted="; (__isset.operationCompleted ? (out << to_string(operationCompleted)) : (out << "<null>"));
+ out << ", " << "hasResultSet="; (__isset.hasResultSet ? (out << to_string(hasResultSet)) : (out << "<null>"));
    out << ")";
  }


http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h
----------------------------------------------------------------------
diff --git a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h
index 838bf17..d23b3cd 100644
--- a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h
+++ b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h
@@ -3709,7 +3709,7 @@ inline std::ostream& operator<<(std::ostream& out, const TGetOperationStatusReq&
  }

  typedef struct _TGetOperationStatusResp__isset {
- _TGetOperationStatusResp__isset() : operationState(false), sqlState(false), errorCode(false), errorMessage(false), taskStatus(false), operationStarted(false), operationCompleted(false) {}
+ _TGetOperationStatusResp__isset() : operationState(false), sqlState(false), errorCode(false), errorMessage(false), taskStatus(false), operationStarted(false), operationCompleted(false), hasResultSet(false) {}
    bool operationState :1;
    bool sqlState :1;
    bool errorCode :1;
@@ -3717,6 +3717,7 @@ typedef struct _TGetOperationStatusResp__isset {
    bool taskStatus :1;
    bool operationStarted :1;
    bool operationCompleted :1;
+ bool hasResultSet :1;
  } _TGetOperationStatusResp__isset;

  class TGetOperationStatusResp {
@@ -3724,7 +3725,7 @@ class TGetOperationStatusResp {

    TGetOperationStatusResp(const TGetOperationStatusResp&);
    TGetOperationStatusResp& operator=(const TGetOperationStatusResp&);
- TGetOperationStatusResp() : operationState((TOperationState::type)0), sqlState(), errorCode(0), errorMessage(), taskStatus(), operationStarted(0), operationCompleted(0) {
+ TGetOperationStatusResp() : operationState((TOperationState::type)0), sqlState(), errorCode(0), errorMessage(), taskStatus(), operationStarted(0), operationCompleted(0), hasResultSet(0) {
    }

    virtual ~TGetOperationStatusResp() throw();
@@ -3736,6 +3737,7 @@ class TGetOperationStatusResp {
    std::string taskStatus;
    int64_t operationStarted;
    int64_t operationCompleted;
+ bool hasResultSet;

    _TGetOperationStatusResp__isset __isset;

@@ -3755,6 +3757,8 @@ class TGetOperationStatusResp {

    void __set_operationCompleted(const int64_t val);

+ void __set_hasResultSet(const bool val);
+
    bool operator == (const TGetOperationStatusResp & rhs) const
    {
      if (!(status == rhs.status))
@@ -3787,6 +3791,10 @@ class TGetOperationStatusResp {
        return false;
      else if (__isset.operationCompleted && !(operationCompleted == rhs.operationCompleted))
        return false;
+ if (__isset.hasResultSet != rhs.__isset.hasResultSet)
+ return false;
+ else if (__isset.hasResultSet && !(hasResultSet == rhs.hasResultSet))
+ return false;
      return true;
    }
    bool operator != (const TGetOperationStatusResp &rhs) const {

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TGetOperationStatusResp.java
----------------------------------------------------------------------
diff --git a/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TGetOperationStatusResp.java b/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TGetOperationStatusResp.java
index 3049280..b981368 100644
--- a/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TGetOperationStatusResp.java
+++ b/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TGetOperationStatusResp.java
@@ -46,6 +46,7 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
    private static final org.apache.thrift.protocol.TField TASK_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("taskStatus", org.apache.thrift.protocol.TType.STRING, (short)6);
    private static final org.apache.thrift.protocol.TField OPERATION_STARTED_FIELD_DESC = new org.apache.thrift.protocol.TField("operationStarted", org.apache.thrift.protocol.TType.I64, (short)7);
    private static final org.apache.thrift.protocol.TField OPERATION_COMPLETED_FIELD_DESC = new org.apache.thrift.protocol.TField("operationCompleted", org.apache.thrift.protocol.TType.I64, (short)8);
+ private static final org.apache.thrift.protocol.TField HAS_RESULT_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("hasResultSet", org.apache.thrift.protocol.TType.BOOL, (short)9);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
@@ -61,6 +62,7 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
    private String taskStatus; // optional
    private long operationStarted; // optional
    private long operationCompleted; // optional
+ private boolean hasResultSet; // optional

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -75,7 +77,8 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
      ERROR_MESSAGE((short)5, "errorMessage"),
      TASK_STATUS((short)6, "taskStatus"),
      OPERATION_STARTED((short)7, "operationStarted"),
- OPERATION_COMPLETED((short)8, "operationCompleted");
+ OPERATION_COMPLETED((short)8, "operationCompleted"),
+ HAS_RESULT_SET((short)9, "hasResultSet");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

@@ -106,6 +109,8 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
            return OPERATION_STARTED;
          case 8: // OPERATION_COMPLETED
            return OPERATION_COMPLETED;
+ case 9: // HAS_RESULT_SET
+ return HAS_RESULT_SET;
          default:
            return null;
        }
@@ -149,8 +154,9 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
    private static final int __ERRORCODE_ISSET_ID = 0;
    private static final int __OPERATIONSTARTED_ISSET_ID = 1;
    private static final int __OPERATIONCOMPLETED_ISSET_ID = 2;
+ private static final int __HASRESULTSET_ISSET_ID = 3;
    private byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.OPERATION_STATE,_Fields.SQL_STATE,_Fields.ERROR_CODE,_Fields.ERROR_MESSAGE,_Fields.TASK_STATUS,_Fields.OPERATION_STARTED,_Fields.OPERATION_COMPLETED};
+ private static final _Fields optionals[] = {_Fields.OPERATION_STATE,_Fields.SQL_STATE,_Fields.ERROR_CODE,_Fields.ERROR_MESSAGE,_Fields.TASK_STATUS,_Fields.OPERATION_STARTED,_Fields.OPERATION_COMPLETED,_Fields.HAS_RESULT_SET};
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -170,6 +176,8 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
      tmpMap.put(_Fields.OPERATION_COMPLETED, new org.apache.thrift.meta_data.FieldMetaData("operationCompleted", org.apache.thrift.TFieldRequirementType.OPTIONAL,
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.HAS_RESULT_SET, new org.apache.thrift.meta_data.FieldMetaData("hasResultSet", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetOperationStatusResp.class, metaDataMap);
    }
@@ -207,6 +215,7 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
      }
      this.operationStarted = other.operationStarted;
      this.operationCompleted = other.operationCompleted;
+ this.hasResultSet = other.hasResultSet;
    }

    public TGetOperationStatusResp deepCopy() {
@@ -226,6 +235,8 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
      this.operationStarted = 0;
      setOperationCompletedIsSet(false);
      this.operationCompleted = 0;
+ setHasResultSetIsSet(false);
+ this.hasResultSet = false;
    }

    public TStatus getStatus() {
@@ -417,6 +428,28 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __OPERATIONCOMPLETED_ISSET_ID, value);
    }

+ public boolean isHasResultSet() {
+ return this.hasResultSet;
+ }
+
+ public void setHasResultSet(boolean hasResultSet) {
+ this.hasResultSet = hasResultSet;
+ setHasResultSetIsSet(true);
+ }
+
+ public void unsetHasResultSet() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HASRESULTSET_ISSET_ID);
+ }
+
+ /** Returns true if field hasResultSet is set (has been assigned a value) and false otherwise */
+ public boolean isSetHasResultSet() {
+ return EncodingUtils.testBit(__isset_bitfield, __HASRESULTSET_ISSET_ID);
+ }
+
+ public void setHasResultSetIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HASRESULTSET_ISSET_ID, value);
+ }
+
    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case STATUS:
@@ -483,6 +516,14 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
        }
        break;

+ case HAS_RESULT_SET:
+ if (value == null) {
+ unsetHasResultSet();
+ } else {
+ setHasResultSet((Boolean)value);
+ }
+ break;
+
      }
    }

@@ -512,6 +553,9 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
      case OPERATION_COMPLETED:
        return getOperationCompleted();

+ case HAS_RESULT_SET:
+ return isHasResultSet();
+
      }
      throw new IllegalStateException();
    }
@@ -539,6 +583,8 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
        return isSetOperationStarted();
      case OPERATION_COMPLETED:
        return isSetOperationCompleted();
+ case HAS_RESULT_SET:
+ return isSetHasResultSet();
      }
      throw new IllegalStateException();
    }
@@ -628,6 +674,15 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
          return false;
      }

+ boolean this_present_hasResultSet = true && this.isSetHasResultSet();
+ boolean that_present_hasResultSet = true && that.isSetHasResultSet();
+ if (this_present_hasResultSet || that_present_hasResultSet) {
+ if (!(this_present_hasResultSet && that_present_hasResultSet))
+ return false;
+ if (this.hasResultSet != that.hasResultSet)
+ return false;
+ }
+
      return true;
    }

@@ -675,6 +730,11 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
      if (present_operationCompleted)
        list.add(operationCompleted);

+ boolean present_hasResultSet = true && (isSetHasResultSet());
+ list.add(present_hasResultSet);
+ if (present_hasResultSet)
+ list.add(hasResultSet);
+
      return list.hashCode();
    }

@@ -766,6 +826,16 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
          return lastComparison;
        }
      }
+ lastComparison = Boolean.valueOf(isSetHasResultSet()).compareTo(other.isSetHasResultSet());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetHasResultSet()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hasResultSet, other.hasResultSet);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
      return 0;
    }

@@ -851,6 +921,12 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
        sb.append(this.operationCompleted);
        first = false;
      }
+ if (isSetHasResultSet()) {
+ if (!first) sb.append(", ");
+ sb.append("hasResultSet:");
+ sb.append(this.hasResultSet);
+ first = false;
+ }
      sb.append(")");
      return sb.toString();
    }
@@ -968,6 +1044,14 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
+ case 9: // HAS_RESULT_SET
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.hasResultSet = iprot.readBool();
+ struct.setHasResultSetIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
@@ -1029,6 +1113,11 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
          oprot.writeI64(struct.operationCompleted);
          oprot.writeFieldEnd();
        }
+ if (struct.isSetHasResultSet()) {
+ oprot.writeFieldBegin(HAS_RESULT_SET_FIELD_DESC);
+ oprot.writeBool(struct.hasResultSet);
+ oprot.writeFieldEnd();
+ }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }
@@ -1069,7 +1158,10 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
        if (struct.isSetOperationCompleted()) {
          optionals.set(6);
        }
- oprot.writeBitSet(optionals, 7);
+ if (struct.isSetHasResultSet()) {
+ optionals.set(7);
+ }
+ oprot.writeBitSet(optionals, 8);
        if (struct.isSetOperationState()) {
          oprot.writeI32(struct.operationState.getValue());
        }
@@ -1091,6 +1183,9 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
        if (struct.isSetOperationCompleted()) {
          oprot.writeI64(struct.operationCompleted);
        }
+ if (struct.isSetHasResultSet()) {
+ oprot.writeBool(struct.hasResultSet);
+ }
      }

      @Override
@@ -1099,7 +1194,7 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
        struct.status = new TStatus();
        struct.status.read(iprot);
        struct.setStatusIsSet(true);
- BitSet incoming = iprot.readBitSet(7);
+ BitSet incoming = iprot.readBitSet(8);
        if (incoming.get(0)) {
          struct.operationState = org.apache.hive.service.rpc.thrift.TOperationState.findByValue(iprot.readI32());
          struct.setOperationStateIsSet(true);
@@ -1128,6 +1223,10 @@ public class TGetOperationStatusResp implements org.apache.thrift.TBase<TGetOper
          struct.operationCompleted = iprot.readI64();
          struct.setOperationCompletedIsSet(true);
        }
+ if (incoming.get(7)) {
+ struct.hasResultSet = iprot.readBool();
+ struct.setHasResultSetIsSet(true);
+ }
      }
    }


http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service-rpc/src/gen/thrift/gen-php/Types.php
----------------------------------------------------------------------
diff --git a/service-rpc/src/gen/thrift/gen-php/Types.php b/service-rpc/src/gen/thrift/gen-php/Types.php
index 9ed7403..a6a257f 100644
--- a/service-rpc/src/gen/thrift/gen-php/Types.php
+++ b/service-rpc/src/gen/thrift/gen-php/Types.php
@@ -8082,6 +8082,10 @@ class TGetOperationStatusResp {
     * @var int
     */
    public $operationCompleted = null;
+ /**
+ * @var bool
+ */
+ public $hasResultSet = null;

    public function __construct($vals=null) {
      if (!isset(self::$_TSPEC)) {
@@ -8119,6 +8123,10 @@ class TGetOperationStatusResp {
            'var' => 'operationCompleted',
            'type' => TType::I64,
            ),
+ 9 => array(
+ 'var' => 'hasResultSet',
+ 'type' => TType::BOOL,
+ ),
          );
      }
      if (is_array($vals)) {
@@ -8146,6 +8154,9 @@ class TGetOperationStatusResp {
        if (isset($vals['operationCompleted'])) {
          $this->operationCompleted = $vals['operationCompleted'];
        }
+ if (isset($vals['hasResultSet'])) {
+ $this->hasResultSet = $vals['hasResultSet'];
+ }
      }
    }

@@ -8225,6 +8236,13 @@ class TGetOperationStatusResp {
              $xfer += $input->skip($ftype);
            }
            break;
+ case 9:
+ if ($ftype == TType::BOOL) {
+ $xfer += $input->readBool($this->hasResultSet);
+ } else {
+ $xfer += $input->skip($ftype);
+ }
+ break;
          default:
            $xfer += $input->skip($ftype);
            break;
@@ -8281,6 +8299,11 @@ class TGetOperationStatusResp {
        $xfer += $output->writeI64($this->operationCompleted);
        $xfer += $output->writeFieldEnd();
      }
+ if ($this->hasResultSet !== null) {
+ $xfer += $output->writeFieldBegin('hasResultSet', TType::BOOL, 9);
+ $xfer += $output->writeBool($this->hasResultSet);
+ $xfer += $output->writeFieldEnd();
+ }
      $xfer += $output->writeFieldStop();
      $xfer += $output->writeStructEnd();
      return $xfer;

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py
----------------------------------------------------------------------
diff --git a/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py b/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py
index 44e5462..fcd330f 100644
--- a/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py
+++ b/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py
@@ -6097,6 +6097,7 @@ class TGetOperationStatusResp:
     - taskStatus
     - operationStarted
     - operationCompleted
+ - hasResultSet
    """

    thrift_spec = (
@@ -6109,9 +6110,10 @@ class TGetOperationStatusResp:
      (6, TType.STRING, 'taskStatus', None, None, ), # 6
      (7, TType.I64, 'operationStarted', None, None, ), # 7
      (8, TType.I64, 'operationCompleted', None, None, ), # 8
+ (9, TType.BOOL, 'hasResultSet', None, None, ), # 9
    )

- def __init__(self, status=None, operationState=None, sqlState=None, errorCode=None, errorMessage=None, taskStatus=None, operationStarted=None, operationCompleted=None,):
+ def __init__(self, status=None, operationState=None, sqlState=None, errorCode=None, errorMessage=None, taskStatus=None, operationStarted=None, operationCompleted=None, hasResultSet=None,):
      self.status = status
      self.operationState = operationState
      self.sqlState = sqlState
@@ -6120,6 +6122,7 @@ class TGetOperationStatusResp:
      self.taskStatus = taskStatus
      self.operationStarted = operationStarted
      self.operationCompleted = operationCompleted
+ self.hasResultSet = hasResultSet

    def read(self, iprot):
      if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
@@ -6171,6 +6174,11 @@ class TGetOperationStatusResp:
            self.operationCompleted = iprot.readI64()
          else:
            iprot.skip(ftype)
+ elif fid == 9:
+ if ftype == TType.BOOL:
+ self.hasResultSet = iprot.readBool()
+ else:
+ iprot.skip(ftype)
        else:
          iprot.skip(ftype)
        iprot.readFieldEnd()
@@ -6213,6 +6221,10 @@ class TGetOperationStatusResp:
        oprot.writeFieldBegin('operationCompleted', TType.I64, 8)
        oprot.writeI64(self.operationCompleted)
        oprot.writeFieldEnd()
+ if self.hasResultSet is not None:
+ oprot.writeFieldBegin('hasResultSet', TType.BOOL, 9)
+ oprot.writeBool(self.hasResultSet)
+ oprot.writeFieldEnd()
      oprot.writeFieldStop()
      oprot.writeStructEnd()

@@ -6232,6 +6244,7 @@ class TGetOperationStatusResp:
      value = (value * 31) ^ hash(self.taskStatus)
      value = (value * 31) ^ hash(self.operationStarted)
      value = (value * 31) ^ hash(self.operationCompleted)
+ value = (value * 31) ^ hash(self.hasResultSet)
      return value

    def __repr__(self):

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb
----------------------------------------------------------------------
diff --git a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb
index b39ec1e..71148a0 100644
--- a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb
+++ b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb
@@ -1571,6 +1571,7 @@ class TGetOperationStatusResp
    TASKSTATUS = 6
    OPERATIONSTARTED = 7
    OPERATIONCOMPLETED = 8
+ HASRESULTSET = 9

    FIELDS = {
      STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::TStatus},
@@ -1580,7 +1581,8 @@ class TGetOperationStatusResp
      ERRORMESSAGE => {:type => ::Thrift::Types::STRING, :name => 'errorMessage', :optional => true},
      TASKSTATUS => {:type => ::Thrift::Types::STRING, :name => 'taskStatus', :optional => true},
      OPERATIONSTARTED => {:type => ::Thrift::Types::I64, :name => 'operationStarted', :optional => true},
- OPERATIONCOMPLETED => {:type => ::Thrift::Types::I64, :name => 'operationCompleted', :optional => true}
+ OPERATIONCOMPLETED => {:type => ::Thrift::Types::I64, :name => 'operationCompleted', :optional => true},
+ HASRESULTSET => {:type => ::Thrift::Types::BOOL, :name => 'hasResultSet', :optional => true}
    }

    def struct_fields; FIELDS; end

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service/src/java/org/apache/hive/service/cli/OperationStatus.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/OperationStatus.java b/service/src/java/org/apache/hive/service/cli/OperationStatus.java
index 5e24d38..b0a26e3 100644
--- a/service/src/java/org/apache/hive/service/cli/OperationStatus.java
+++ b/service/src/java/org/apache/hive/service/cli/OperationStatus.java
@@ -28,13 +28,15 @@ public class OperationStatus {
    private final String taskStatus;
    private final long operationStarted;
    private final long operationCompleted;
+ private final boolean hasResultSet;
    private final HiveSQLException operationException;

- public OperationStatus(OperationState state, String taskStatus, long operationStarted, long operationCompleted, HiveSQLException operationException) {
+ public OperationStatus(OperationState state, String taskStatus, long operationStarted, long operationCompleted, boolean hasResultSet, HiveSQLException operationException) {
      this.state = state;
      this.taskStatus = taskStatus;
      this.operationStarted = operationStarted;
      this.operationCompleted = operationCompleted;
+ this.hasResultSet = hasResultSet;
      this.operationException = operationException;
    }

@@ -54,6 +56,10 @@ public class OperationStatus {
      return operationCompleted;
    }

+ public boolean getHasResultSet() {
+ return hasResultSet;
+ }
+
    public HiveSQLException getOperationException() {
      return operationException;
    }

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service/src/java/org/apache/hive/service/cli/operation/Operation.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/operation/Operation.java b/service/src/java/org/apache/hive/service/cli/operation/Operation.java
index 0932884..d48b92c 100644
--- a/service/src/java/org/apache/hive/service/cli/operation/Operation.java
+++ b/service/src/java/org/apache/hive/service/cli/operation/Operation.java
@@ -144,7 +144,7 @@ public abstract class Operation {
      } catch (HiveSQLException sqlException) {
        LOG.error("Error getting task status for " + opHandle.toString(), sqlException);
      }
- return new OperationStatus(state, taskStatus, operationStart, operationComplete, operationException);
+ return new OperationStatus(state, taskStatus, operationStart, operationComplete, hasResultSet, operationException);
    }

    public boolean hasResultSet() {

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
index 5464e58..8bc3d94 100644
--- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
+++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
@@ -629,6 +629,7 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
        resp.setTaskStatus(operationStatus.getTaskStatus());
        resp.setOperationStarted(operationStatus.getOperationStarted());
        resp.setOperationCompleted(operationStatus.getOperationCompleted());
+ resp.setHasResultSet(operationStatus.getHasResultSet());
        if (opException != null) {
          resp.setSqlState(opException.getSQLState());
          resp.setErrorCode(opException.getErrorCode());

http://git-wip-us.apache.org/repos/asf/hive/blob/aed35035/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java
index 82ac42d..3c48dbb 100644
--- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java
+++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java
@@ -370,7 +370,7 @@ public class ThriftCLIServiceClient extends CLIServiceClient {
          opException = new HiveSQLException(resp.getErrorMessage(), resp.getSqlState(), resp.getErrorCode());
        }
        return new OperationStatus(opState, resp.getTaskStatus(), resp.getOperationStarted(),
- resp.getOperationCompleted(), opException);
+ resp.getOperationCompleted(), resp.isHasResultSet(), opException);
      } catch (HiveSQLException e) {
        throw e;
      } catch (Exception e) {

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedMay 31, '16 at 2:45p
activeMay 31, '16 at 2:45p
posts1
users1
websitehive.apache.org

1 user in discussion

Aihuaxu: 1 post

People

Translate

site design / logo © 2021 Grokbase