You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2018/03/29 19:09:52 UTC

hive git commit: HIVE-19055 : WM alter may fail if the name is not changed (Sergey Shelukhin, reviewed by Prasanth Jayachandran)

Repository: hive
Updated Branches:
  refs/heads/master 14bb998cf -> 67c8ac103


HIVE-19055 : WM alter may fail if the name is not changed (Sergey Shelukhin, reviewed by Prasanth Jayachandran)


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

Branch: refs/heads/master
Commit: 67c8ac103d893051f0f58b1032d86888b5c7cf85
Parents: 14bb998
Author: sergey <se...@apache.org>
Authored: Thu Mar 29 12:09:17 2018 -0700
Committer: sergey <se...@apache.org>
Committed: Thu Mar 29 12:09:17 2018 -0700

----------------------------------------------------------------------
 .../hive/ql/parse/DDLSemanticAnalyzer.java      |  3 +
 .../gen/thrift/gen-cpp/hive_metastore_types.cpp | 17 +++--
 .../gen/thrift/gen-cpp/hive_metastore_types.h   |  7 +-
 .../metastore/api/WMNullableResourcePlan.java   | 74 ++++++++++----------
 .../gen/thrift/gen-py/hive_metastore/ttypes.py  |  2 -
 .../gen/thrift/gen-rb/hive_metastore_types.rb   |  3 +-
 .../src/main/thrift/hive_metastore.thrift       |  2 +-
 7 files changed, 55 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/67c8ac10/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
index 5b9ab3a..74c271d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
@@ -1255,6 +1255,9 @@ public class DDLSemanticAnalyzer extends BaseSemanticAnalyzer {
       addServiceOutput();
     }
     if (poolChanges != null) {
+      if (!poolChanges.isSetPoolPath()) {
+        poolChanges.setPoolPath(poolPath);
+      }
       rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
           new CreateOrAlterWMPoolDesc(poolChanges, poolPath, true))));
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/67c8ac10/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp b/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp
index b254f69..8e357f6 100644
--- a/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp
+++ b/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp
@@ -23286,6 +23286,7 @@ WMNullableResourcePlan::~WMNullableResourcePlan() throw() {
 
 void WMNullableResourcePlan::__set_name(const std::string& val) {
   this->name = val;
+__isset.name = true;
 }
 
 void WMNullableResourcePlan::__set_status(const WMResourcePlanStatus::type val) {
@@ -23325,7 +23326,6 @@ uint32_t WMNullableResourcePlan::read(::apache::thrift::protocol::TProtocol* ipr
 
   using ::apache::thrift::protocol::TProtocolException;
 
-  bool isset_name = false;
 
   while (true)
   {
@@ -23338,7 +23338,7 @@ uint32_t WMNullableResourcePlan::read(::apache::thrift::protocol::TProtocol* ipr
       case 1:
         if (ftype == ::apache::thrift::protocol::T_STRING) {
           xfer += iprot->readString(this->name);
-          isset_name = true;
+          this->__isset.name = true;
         } else {
           xfer += iprot->skip(ftype);
         }
@@ -23394,8 +23394,6 @@ uint32_t WMNullableResourcePlan::read(::apache::thrift::protocol::TProtocol* ipr
 
   xfer += iprot->readStructEnd();
 
-  if (!isset_name)
-    throw TProtocolException(TProtocolException::INVALID_DATA);
   return xfer;
 }
 
@@ -23404,10 +23402,11 @@ uint32_t WMNullableResourcePlan::write(::apache::thrift::protocol::TProtocol* op
   apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
   xfer += oprot->writeStructBegin("WMNullableResourcePlan");
 
-  xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1);
-  xfer += oprot->writeString(this->name);
-  xfer += oprot->writeFieldEnd();
-
+  if (this->__isset.name) {
+    xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1);
+    xfer += oprot->writeString(this->name);
+    xfer += oprot->writeFieldEnd();
+  }
   if (this->__isset.status) {
     xfer += oprot->writeFieldBegin("status", ::apache::thrift::protocol::T_I32, 2);
     xfer += oprot->writeI32((int32_t)this->status);
@@ -23471,7 +23470,7 @@ WMNullableResourcePlan& WMNullableResourcePlan::operator=(const WMNullableResour
 void WMNullableResourcePlan::printTo(std::ostream& out) const {
   using ::apache::thrift::to_string;
   out << "WMNullableResourcePlan(";
-  out << "name=" << to_string(name);
+  out << "name="; (__isset.name ? (out << to_string(name)) : (out << "<null>"));
   out << ", " << "status="; (__isset.status ? (out << to_string(status)) : (out << "<null>"));
   out << ", " << "queryParallelism="; (__isset.queryParallelism ? (out << to_string(queryParallelism)) : (out << "<null>"));
   out << ", " << "isSetQueryParallelism="; (__isset.isSetQueryParallelism ? (out << to_string(isSetQueryParallelism)) : (out << "<null>"));

http://git-wip-us.apache.org/repos/asf/hive/blob/67c8ac10/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h b/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
index b094831..724f022 100644
--- a/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
+++ b/standalone-metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
@@ -9583,7 +9583,8 @@ inline std::ostream& operator<<(std::ostream& out, const WMResourcePlan& obj)
 }
 
 typedef struct _WMNullableResourcePlan__isset {
-  _WMNullableResourcePlan__isset() : status(false), queryParallelism(false), isSetQueryParallelism(false), defaultPoolPath(false), isSetDefaultPoolPath(false) {}
+  _WMNullableResourcePlan__isset() : name(false), status(false), queryParallelism(false), isSetQueryParallelism(false), defaultPoolPath(false), isSetDefaultPoolPath(false) {}
+  bool name :1;
   bool status :1;
   bool queryParallelism :1;
   bool isSetQueryParallelism :1;
@@ -9623,7 +9624,9 @@ class WMNullableResourcePlan {
 
   bool operator == (const WMNullableResourcePlan & rhs) const
   {
-    if (!(name == rhs.name))
+    if (__isset.name != rhs.__isset.name)
+      return false;
+    else if (__isset.name && !(name == rhs.name))
       return false;
     if (__isset.status != rhs.__isset.status)
       return false;

http://git-wip-us.apache.org/repos/asf/hive/blob/67c8ac10/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/WMNullableResourcePlan.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/WMNullableResourcePlan.java b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/WMNullableResourcePlan.java
index 7b7cefc..4621e10 100644
--- a/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/WMNullableResourcePlan.java
+++ b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/WMNullableResourcePlan.java
@@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory;
     schemes.put(TupleScheme.class, new WMNullableResourcePlanTupleSchemeFactory());
   }
 
-  private String name; // required
+  private String name; // optional
   private WMResourcePlanStatus status; // optional
   private int queryParallelism; // optional
   private boolean isSetQueryParallelism; // optional
@@ -140,11 +140,11 @@ import org.slf4j.LoggerFactory;
   private static final int __ISSETQUERYPARALLELISM_ISSET_ID = 1;
   private static final int __ISSETDEFAULTPOOLPATH_ISSET_ID = 2;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.STATUS,_Fields.QUERY_PARALLELISM,_Fields.IS_SET_QUERY_PARALLELISM,_Fields.DEFAULT_POOL_PATH,_Fields.IS_SET_DEFAULT_POOL_PATH};
+  private static final _Fields optionals[] = {_Fields.NAME,_Fields.STATUS,_Fields.QUERY_PARALLELISM,_Fields.IS_SET_QUERY_PARALLELISM,_Fields.DEFAULT_POOL_PATH,_Fields.IS_SET_DEFAULT_POOL_PATH};
   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);
-    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, WMResourcePlanStatus.class)));
@@ -163,13 +163,6 @@ import org.slf4j.LoggerFactory;
   public WMNullableResourcePlan() {
   }
 
-  public WMNullableResourcePlan(
-    String name)
-  {
-    this();
-    this.name = name;
-  }
-
   /**
    * Performs a deep copy on <i>other</i>.
    */
@@ -644,13 +637,15 @@ import org.slf4j.LoggerFactory;
     StringBuilder sb = new StringBuilder("WMNullableResourcePlan(");
     boolean first = true;
 
-    sb.append("name:");
-    if (this.name == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.name);
+    if (isSetName()) {
+      sb.append("name:");
+      if (this.name == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.name);
+      }
+      first = false;
     }
-    first = false;
     if (isSetStatus()) {
       if (!first) sb.append(", ");
       sb.append("status:");
@@ -695,10 +690,6 @@ import org.slf4j.LoggerFactory;
 
   public void validate() throws org.apache.thrift.TException {
     // check for required fields
-    if (!isSetName()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' is unset! Struct:" + toString());
-    }
-
     // check for sub-struct validity
   }
 
@@ -800,9 +791,11 @@ import org.slf4j.LoggerFactory;
 
       oprot.writeStructBegin(STRUCT_DESC);
       if (struct.name != null) {
-        oprot.writeFieldBegin(NAME_FIELD_DESC);
-        oprot.writeString(struct.name);
-        oprot.writeFieldEnd();
+        if (struct.isSetName()) {
+          oprot.writeFieldBegin(NAME_FIELD_DESC);
+          oprot.writeString(struct.name);
+          oprot.writeFieldEnd();
+        }
       }
       if (struct.status != null) {
         if (struct.isSetStatus()) {
@@ -850,24 +843,29 @@ import org.slf4j.LoggerFactory;
     @Override
     public void write(org.apache.thrift.protocol.TProtocol prot, WMNullableResourcePlan struct) throws org.apache.thrift.TException {
       TTupleProtocol oprot = (TTupleProtocol) prot;
-      oprot.writeString(struct.name);
       BitSet optionals = new BitSet();
-      if (struct.isSetStatus()) {
+      if (struct.isSetName()) {
         optionals.set(0);
       }
-      if (struct.isSetQueryParallelism()) {
+      if (struct.isSetStatus()) {
         optionals.set(1);
       }
-      if (struct.isSetIsSetQueryParallelism()) {
+      if (struct.isSetQueryParallelism()) {
         optionals.set(2);
       }
-      if (struct.isSetDefaultPoolPath()) {
+      if (struct.isSetIsSetQueryParallelism()) {
         optionals.set(3);
       }
-      if (struct.isSetIsSetDefaultPoolPath()) {
+      if (struct.isSetDefaultPoolPath()) {
         optionals.set(4);
       }
-      oprot.writeBitSet(optionals, 5);
+      if (struct.isSetIsSetDefaultPoolPath()) {
+        optionals.set(5);
+      }
+      oprot.writeBitSet(optionals, 6);
+      if (struct.isSetName()) {
+        oprot.writeString(struct.name);
+      }
       if (struct.isSetStatus()) {
         oprot.writeI32(struct.status.getValue());
       }
@@ -888,26 +886,28 @@ import org.slf4j.LoggerFactory;
     @Override
     public void read(org.apache.thrift.protocol.TProtocol prot, WMNullableResourcePlan struct) throws org.apache.thrift.TException {
       TTupleProtocol iprot = (TTupleProtocol) prot;
-      struct.name = iprot.readString();
-      struct.setNameIsSet(true);
-      BitSet incoming = iprot.readBitSet(5);
+      BitSet incoming = iprot.readBitSet(6);
       if (incoming.get(0)) {
+        struct.name = iprot.readString();
+        struct.setNameIsSet(true);
+      }
+      if (incoming.get(1)) {
         struct.status = org.apache.hadoop.hive.metastore.api.WMResourcePlanStatus.findByValue(iprot.readI32());
         struct.setStatusIsSet(true);
       }
-      if (incoming.get(1)) {
+      if (incoming.get(2)) {
         struct.queryParallelism = iprot.readI32();
         struct.setQueryParallelismIsSet(true);
       }
-      if (incoming.get(2)) {
+      if (incoming.get(3)) {
         struct.isSetQueryParallelism = iprot.readBool();
         struct.setIsSetQueryParallelismIsSet(true);
       }
-      if (incoming.get(3)) {
+      if (incoming.get(4)) {
         struct.defaultPoolPath = iprot.readString();
         struct.setDefaultPoolPathIsSet(true);
       }
-      if (incoming.get(4)) {
+      if (incoming.get(5)) {
         struct.isSetDefaultPoolPath = iprot.readBool();
         struct.setIsSetDefaultPoolPathIsSet(true);
       }

http://git-wip-us.apache.org/repos/asf/hive/blob/67c8ac10/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py b/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
index 82539ed..fd157b2 100644
--- a/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
+++ b/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
@@ -16326,8 +16326,6 @@ class WMNullableResourcePlan:
     oprot.writeStructEnd()
 
   def validate(self):
-    if self.name is None:
-      raise TProtocol.TProtocolException(message='Required field name is unset!')
     return
 
 

http://git-wip-us.apache.org/repos/asf/hive/blob/67c8ac10/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb b/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
index 16c814e..aa93158 100644
--- a/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
+++ b/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
@@ -3688,7 +3688,7 @@ class WMNullableResourcePlan
   ISSETDEFAULTPOOLPATH = 7
 
   FIELDS = {
-    NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
+    NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :optional => true},
     STATUS => {:type => ::Thrift::Types::I32, :name => 'status', :optional => true, :enum_class => ::WMResourcePlanStatus},
     QUERYPARALLELISM => {:type => ::Thrift::Types::I32, :name => 'queryParallelism', :optional => true},
     ISSETQUERYPARALLELISM => {:type => ::Thrift::Types::BOOL, :name => 'isSetQueryParallelism', :optional => true},
@@ -3699,7 +3699,6 @@ class WMNullableResourcePlan
   def struct_fields; FIELDS; end
 
   def validate
-    raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
     unless @status.nil? || ::WMResourcePlanStatus::VALID_VALUES.include?(@status)
       raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field status!')
     end

http://git-wip-us.apache.org/repos/asf/hive/blob/67c8ac10/standalone-metastore/src/main/thrift/hive_metastore.thrift
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/thrift/hive_metastore.thrift b/standalone-metastore/src/main/thrift/hive_metastore.thrift
index fb334c0..68d7b45 100644
--- a/standalone-metastore/src/main/thrift/hive_metastore.thrift
+++ b/standalone-metastore/src/main/thrift/hive_metastore.thrift
@@ -1186,7 +1186,7 @@ struct WMResourcePlan {
 }
 
 struct WMNullableResourcePlan {
-  1: required string name;
+  1: optional string name;
   2: optional WMResourcePlanStatus status;
   4: optional i32 queryParallelism;
   5: optional bool isSetQueryParallelism;