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/01/18 21:29:06 UTC
[2/6] hive git commit: HIVE-18438 : WM RP: it's impossible to unset
things (Sergey Shelukhin, reviewed by Harish Jaiprakash,
Prasanth Jayachandran)
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/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 e5f3e6c..c3be4c4 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
@@ -14907,6 +14907,139 @@ class WMResourcePlan:
def __ne__(self, other):
return not (self == other)
+class WMNullableResourcePlan:
+ """
+ Attributes:
+ - name
+ - status
+ - queryParallelism
+ - isSetQueryParallelism
+ - defaultPoolPath
+ - isSetDefaultPoolPath
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'name', None, None, ), # 1
+ (2, TType.I32, 'status', None, None, ), # 2
+ None, # 3
+ (4, TType.I32, 'queryParallelism', None, None, ), # 4
+ (5, TType.BOOL, 'isSetQueryParallelism', None, None, ), # 5
+ (6, TType.STRING, 'defaultPoolPath', None, None, ), # 6
+ (7, TType.BOOL, 'isSetDefaultPoolPath', None, None, ), # 7
+ )
+
+ def __init__(self, name=None, status=None, queryParallelism=None, isSetQueryParallelism=None, defaultPoolPath=None, isSetDefaultPoolPath=None,):
+ self.name = name
+ self.status = status
+ self.queryParallelism = queryParallelism
+ self.isSetQueryParallelism = isSetQueryParallelism
+ self.defaultPoolPath = defaultPoolPath
+ self.isSetDefaultPoolPath = isSetDefaultPoolPath
+
+ 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:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.name = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.I32:
+ self.status = iprot.readI32()
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.I32:
+ self.queryParallelism = iprot.readI32()
+ else:
+ iprot.skip(ftype)
+ elif fid == 5:
+ if ftype == TType.BOOL:
+ self.isSetQueryParallelism = iprot.readBool()
+ else:
+ iprot.skip(ftype)
+ elif fid == 6:
+ if ftype == TType.STRING:
+ self.defaultPoolPath = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 7:
+ if ftype == TType.BOOL:
+ self.isSetDefaultPoolPath = iprot.readBool()
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('WMNullableResourcePlan')
+ if self.name is not None:
+ oprot.writeFieldBegin('name', TType.STRING, 1)
+ oprot.writeString(self.name)
+ oprot.writeFieldEnd()
+ if self.status is not None:
+ oprot.writeFieldBegin('status', TType.I32, 2)
+ oprot.writeI32(self.status)
+ oprot.writeFieldEnd()
+ if self.queryParallelism is not None:
+ oprot.writeFieldBegin('queryParallelism', TType.I32, 4)
+ oprot.writeI32(self.queryParallelism)
+ oprot.writeFieldEnd()
+ if self.isSetQueryParallelism is not None:
+ oprot.writeFieldBegin('isSetQueryParallelism', TType.BOOL, 5)
+ oprot.writeBool(self.isSetQueryParallelism)
+ oprot.writeFieldEnd()
+ if self.defaultPoolPath is not None:
+ oprot.writeFieldBegin('defaultPoolPath', TType.STRING, 6)
+ oprot.writeString(self.defaultPoolPath)
+ oprot.writeFieldEnd()
+ if self.isSetDefaultPoolPath is not None:
+ oprot.writeFieldBegin('isSetDefaultPoolPath', TType.BOOL, 7)
+ oprot.writeBool(self.isSetDefaultPoolPath)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.name is None:
+ raise TProtocol.TProtocolException(message='Required field name is unset!')
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.name)
+ value = (value * 31) ^ hash(self.status)
+ value = (value * 31) ^ hash(self.queryParallelism)
+ value = (value * 31) ^ hash(self.isSetQueryParallelism)
+ value = (value * 31) ^ hash(self.defaultPoolPath)
+ value = (value * 31) ^ hash(self.isSetDefaultPoolPath)
+ return value
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
class WMPool:
"""
Attributes:
@@ -15028,6 +15161,140 @@ class WMPool:
def __ne__(self, other):
return not (self == other)
+class WMNullablePool:
+ """
+ Attributes:
+ - resourcePlanName
+ - poolPath
+ - allocFraction
+ - queryParallelism
+ - schedulingPolicy
+ - isSetSchedulingPolicy
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'resourcePlanName', None, None, ), # 1
+ (2, TType.STRING, 'poolPath', None, None, ), # 2
+ (3, TType.DOUBLE, 'allocFraction', None, None, ), # 3
+ (4, TType.I32, 'queryParallelism', None, None, ), # 4
+ (5, TType.STRING, 'schedulingPolicy', None, None, ), # 5
+ (6, TType.BOOL, 'isSetSchedulingPolicy', None, None, ), # 6
+ )
+
+ def __init__(self, resourcePlanName=None, poolPath=None, allocFraction=None, queryParallelism=None, schedulingPolicy=None, isSetSchedulingPolicy=None,):
+ self.resourcePlanName = resourcePlanName
+ self.poolPath = poolPath
+ self.allocFraction = allocFraction
+ self.queryParallelism = queryParallelism
+ self.schedulingPolicy = schedulingPolicy
+ self.isSetSchedulingPolicy = isSetSchedulingPolicy
+
+ 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:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.resourcePlanName = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.poolPath = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.DOUBLE:
+ self.allocFraction = iprot.readDouble()
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.I32:
+ self.queryParallelism = iprot.readI32()
+ else:
+ iprot.skip(ftype)
+ elif fid == 5:
+ if ftype == TType.STRING:
+ self.schedulingPolicy = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 6:
+ if ftype == TType.BOOL:
+ self.isSetSchedulingPolicy = iprot.readBool()
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('WMNullablePool')
+ if self.resourcePlanName is not None:
+ oprot.writeFieldBegin('resourcePlanName', TType.STRING, 1)
+ oprot.writeString(self.resourcePlanName)
+ oprot.writeFieldEnd()
+ if self.poolPath is not None:
+ oprot.writeFieldBegin('poolPath', TType.STRING, 2)
+ oprot.writeString(self.poolPath)
+ oprot.writeFieldEnd()
+ if self.allocFraction is not None:
+ oprot.writeFieldBegin('allocFraction', TType.DOUBLE, 3)
+ oprot.writeDouble(self.allocFraction)
+ oprot.writeFieldEnd()
+ if self.queryParallelism is not None:
+ oprot.writeFieldBegin('queryParallelism', TType.I32, 4)
+ oprot.writeI32(self.queryParallelism)
+ oprot.writeFieldEnd()
+ if self.schedulingPolicy is not None:
+ oprot.writeFieldBegin('schedulingPolicy', TType.STRING, 5)
+ oprot.writeString(self.schedulingPolicy)
+ oprot.writeFieldEnd()
+ if self.isSetSchedulingPolicy is not None:
+ oprot.writeFieldBegin('isSetSchedulingPolicy', TType.BOOL, 6)
+ oprot.writeBool(self.isSetSchedulingPolicy)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.resourcePlanName is None:
+ raise TProtocol.TProtocolException(message='Required field resourcePlanName is unset!')
+ if self.poolPath is None:
+ raise TProtocol.TProtocolException(message='Required field poolPath is unset!')
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.resourcePlanName)
+ value = (value * 31) ^ hash(self.poolPath)
+ value = (value * 31) ^ hash(self.allocFraction)
+ value = (value * 31) ^ hash(self.queryParallelism)
+ value = (value * 31) ^ hash(self.schedulingPolicy)
+ value = (value * 31) ^ hash(self.isSetSchedulingPolicy)
+ return value
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
class WMTrigger:
"""
Attributes:
@@ -16013,7 +16280,7 @@ class WMAlterResourcePlanRequest:
thrift_spec = (
None, # 0
(1, TType.STRING, 'resourcePlanName', None, None, ), # 1
- (2, TType.STRUCT, 'resourcePlan', (WMResourcePlan, WMResourcePlan.thrift_spec), None, ), # 2
+ (2, TType.STRUCT, 'resourcePlan', (WMNullableResourcePlan, WMNullableResourcePlan.thrift_spec), None, ), # 2
(3, TType.BOOL, 'isEnableAndActivate', None, None, ), # 3
(4, TType.BOOL, 'isForceDeactivate', None, None, ), # 4
(5, TType.BOOL, 'isReplace', None, None, ), # 5
@@ -16042,7 +16309,7 @@ class WMAlterResourcePlanRequest:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
- self.resourcePlan = WMResourcePlan()
+ self.resourcePlan = WMNullableResourcePlan()
self.resourcePlan.read(iprot)
else:
iprot.skip(ftype)
@@ -17041,7 +17308,7 @@ class WMAlterPoolRequest:
thrift_spec = (
None, # 0
- (1, TType.STRUCT, 'pool', (WMPool, WMPool.thrift_spec), None, ), # 1
+ (1, TType.STRUCT, 'pool', (WMNullablePool, WMNullablePool.thrift_spec), None, ), # 1
(2, TType.STRING, 'poolPath', None, None, ), # 2
)
@@ -17060,7 +17327,7 @@ class WMAlterPoolRequest:
break
if fid == 1:
if ftype == TType.STRUCT:
- self.pool = WMPool()
+ self.pool = WMNullablePool()
self.pool.read(iprot)
else:
iprot.skip(ftype)
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/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 afcec9e..439553f 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
@@ -3360,6 +3360,36 @@ class WMResourcePlan
::Thrift::Struct.generate_accessors self
end
+class WMNullableResourcePlan
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ NAME = 1
+ STATUS = 2
+ QUERYPARALLELISM = 4
+ ISSETQUERYPARALLELISM = 5
+ DEFAULTPOOLPATH = 6
+ ISSETDEFAULTPOOLPATH = 7
+
+ FIELDS = {
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
+ 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},
+ DEFAULTPOOLPATH => {:type => ::Thrift::Types::STRING, :name => 'defaultPoolPath', :optional => true},
+ ISSETDEFAULTPOOLPATH => {:type => ::Thrift::Types::BOOL, :name => 'isSetDefaultPoolPath', :optional => true}
+ }
+
+ 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
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
class WMPool
include ::Thrift::Struct, ::Thrift::Struct_Union
RESOURCEPLANNAME = 1
@@ -3386,6 +3416,34 @@ class WMPool
::Thrift::Struct.generate_accessors self
end
+class WMNullablePool
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ RESOURCEPLANNAME = 1
+ POOLPATH = 2
+ ALLOCFRACTION = 3
+ QUERYPARALLELISM = 4
+ SCHEDULINGPOLICY = 5
+ ISSETSCHEDULINGPOLICY = 6
+
+ FIELDS = {
+ RESOURCEPLANNAME => {:type => ::Thrift::Types::STRING, :name => 'resourcePlanName'},
+ POOLPATH => {:type => ::Thrift::Types::STRING, :name => 'poolPath'},
+ ALLOCFRACTION => {:type => ::Thrift::Types::DOUBLE, :name => 'allocFraction', :optional => true},
+ QUERYPARALLELISM => {:type => ::Thrift::Types::I32, :name => 'queryParallelism', :optional => true},
+ SCHEDULINGPOLICY => {:type => ::Thrift::Types::STRING, :name => 'schedulingPolicy', :optional => true},
+ ISSETSCHEDULINGPOLICY => {:type => ::Thrift::Types::BOOL, :name => 'isSetSchedulingPolicy', :optional => true}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field resourcePlanName is unset!') unless @resourcePlanName
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field poolPath is unset!') unless @poolPath
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
class WMTrigger
include ::Thrift::Struct, ::Thrift::Struct_Union
RESOURCEPLANNAME = 1
@@ -3622,7 +3680,7 @@ class WMAlterResourcePlanRequest
FIELDS = {
RESOURCEPLANNAME => {:type => ::Thrift::Types::STRING, :name => 'resourcePlanName', :optional => true},
- RESOURCEPLAN => {:type => ::Thrift::Types::STRUCT, :name => 'resourcePlan', :class => ::WMResourcePlan, :optional => true},
+ RESOURCEPLAN => {:type => ::Thrift::Types::STRUCT, :name => 'resourcePlan', :class => ::WMNullableResourcePlan, :optional => true},
ISENABLEANDACTIVATE => {:type => ::Thrift::Types::BOOL, :name => 'isEnableAndActivate', :optional => true},
ISFORCEDEACTIVATE => {:type => ::Thrift::Types::BOOL, :name => 'isForceDeactivate', :optional => true},
ISREPLACE => {:type => ::Thrift::Types::BOOL, :name => 'isReplace', :optional => true}
@@ -3879,7 +3937,7 @@ class WMAlterPoolRequest
POOLPATH = 2
FIELDS = {
- POOL => {:type => ::Thrift::Types::STRUCT, :name => 'pool', :class => ::WMPool, :optional => true},
+ POOL => {:type => ::Thrift::Types::STRUCT, :name => 'pool', :class => ::WMNullablePool, :optional => true},
POOLPATH => {:type => ::Thrift::Types::STRING, :name => 'poolPath', :optional => true}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 53a8669..c44099f 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -2676,7 +2676,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
}
@Override
- public WMFullResourcePlan alterResourcePlan(String resourcePlanName, WMResourcePlan resourcePlan,
+ public WMFullResourcePlan alterResourcePlan(String resourcePlanName, WMNullableResourcePlan resourcePlan,
boolean canActivateDisabled, boolean isForceDeactivate, boolean isReplace)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException {
WMAlterResourcePlanRequest request = new WMAlterResourcePlanRequest();
@@ -2744,7 +2744,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
}
@Override
- public void alterWMPool(WMPool pool, String poolPath)
+ public void alterWMPool(WMNullablePool pool, String poolPath)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException {
WMAlterPoolRequest request = new WMAlterPoolRequest();
request.setPool(pool);
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
index 3261405..238c5ed 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
@@ -105,6 +105,8 @@ import org.apache.hadoop.hive.metastore.api.UnknownPartitionException;
import org.apache.hadoop.hive.metastore.api.UnknownTableException;
import org.apache.hadoop.hive.metastore.api.WMFullResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMMapping;
+import org.apache.hadoop.hive.metastore.api.WMNullablePool;
+import org.apache.hadoop.hive.metastore.api.WMNullableResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMPool;
import org.apache.hadoop.hive.metastore.api.WMResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMTrigger;
@@ -1819,7 +1821,7 @@ public interface IMetaStoreClient {
void dropResourcePlan(String resourcePlanName)
throws NoSuchObjectException, MetaException, TException;
- WMFullResourcePlan alterResourcePlan(String resourcePlanName, WMResourcePlan resourcePlan,
+ WMFullResourcePlan alterResourcePlan(String resourcePlanName, WMNullableResourcePlan resourcePlan,
boolean canActivateDisabled, boolean isForceDeactivate, boolean isReplace)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException;
@@ -1843,7 +1845,7 @@ public interface IMetaStoreClient {
void createWMPool(WMPool pool)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException;
- void alterWMPool(WMPool pool, String poolPath)
+ void alterWMPool(WMNullablePool pool, String poolPath)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException;
void dropWMPool(String resourcePlanName, String poolPath)
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index b9fecc7..6f5d8a6 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -133,6 +133,8 @@ import org.apache.hadoop.hive.metastore.api.UnknownPartitionException;
import org.apache.hadoop.hive.metastore.api.UnknownTableException;
import org.apache.hadoop.hive.metastore.api.WMFullResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMMapping;
+import org.apache.hadoop.hive.metastore.api.WMNullablePool;
+import org.apache.hadoop.hive.metastore.api.WMNullableResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMPool;
import org.apache.hadoop.hive.metastore.api.WMPoolTrigger;
import org.apache.hadoop.hive.metastore.api.WMResourcePlan;
@@ -9904,7 +9906,7 @@ public class ObjectStore implements RawStore, Configurable {
}
@Override
- public WMFullResourcePlan alterResourcePlan(String name, WMResourcePlan changes,
+ public WMFullResourcePlan alterResourcePlan(String name, WMNullableResourcePlan changes,
boolean canActivateDisabled, boolean canDeactivate, boolean isReplace)
throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException, MetaException {
name = name == null ? null : normalizeIdentifier(name);
@@ -9935,14 +9937,15 @@ public class ObjectStore implements RawStore, Configurable {
}
}
- private WMFullResourcePlan handleSimpleAlter(String name, WMResourcePlan changes,
+ private WMFullResourcePlan handleSimpleAlter(String name, WMNullableResourcePlan changes,
boolean canActivateDisabled, boolean canDeactivate)
throws InvalidOperationException, NoSuchObjectException, MetaException {
MWMResourcePlan plan = name == null ? getActiveMWMResourcePlan()
: getMWMResourcePlan(name, !changes.isSetStatus());
boolean hasNameChange = changes.isSetName() && !changes.getName().equals(name);
// Verify that field changes are consistent with what Hive does. Note: we could handle this.
- if (changes.isSetQueryParallelism() || changes.isSetDefaultPoolPath() || hasNameChange) {
+ if (changes.isSetIsSetQueryParallelism()
+ || changes.isSetIsSetDefaultPoolPath() || hasNameChange) {
if (changes.isSetStatus()) {
throw new InvalidOperationException("Cannot change values during status switch.");
} else if (plan.getStatus() != MWMResourcePlan.Status.DISABLED) {
@@ -9960,15 +9963,23 @@ public class ObjectStore implements RawStore, Configurable {
plan.setName(newName);
}
}
- if (changes.isSetQueryParallelism()) {
- if (changes.getQueryParallelism() <= 0) {
- throw new InvalidOperationException("queryParallelism should be positive.");
+ if (changes.isSetIsSetQueryParallelism() && changes.isIsSetQueryParallelism()) {
+ if (changes.isSetQueryParallelism()) {
+ if (changes.getQueryParallelism() <= 0) {
+ throw new InvalidOperationException("queryParallelism should be positive.");
+ }
+ plan.setQueryParallelism(changes.getQueryParallelism());
+ } else {
+ plan.setQueryParallelism(null);
}
- plan.setQueryParallelism(changes.getQueryParallelism());
}
- if (changes.isSetDefaultPoolPath()) {
- MWMPool pool = getPool(plan, changes.getDefaultPoolPath());
- plan.setDefaultPool(pool);
+ if (changes.isSetIsSetDefaultPoolPath() && changes.isIsSetDefaultPoolPath()) {
+ if (changes.isSetDefaultPoolPath()) {
+ MWMPool pool = getPool(plan, changes.getDefaultPoolPath());
+ plan.setDefaultPool(pool);
+ } else {
+ plan.setDefaultPool(null);
+ }
}
// Handle the status change.
@@ -9979,7 +9990,7 @@ public class ObjectStore implements RawStore, Configurable {
return null;
}
- private WMFullResourcePlan handleAlterReplace(String name, WMResourcePlan changes)
+ private WMFullResourcePlan handleAlterReplace(String name, WMNullableResourcePlan changes)
throws InvalidOperationException, NoSuchObjectException, MetaException {
// Verify that field changes are consistent with what Hive does. Note: we could handle this.
if (changes.isSetQueryParallelism() || changes.isSetDefaultPoolPath()) {
@@ -10432,7 +10443,7 @@ public class ObjectStore implements RawStore, Configurable {
}
@Override
- public void alterPool(WMPool pool, String poolPath) throws AlreadyExistsException,
+ public void alterPool(WMNullablePool pool, String poolPath) throws AlreadyExistsException,
NoSuchObjectException, InvalidOperationException, MetaException {
boolean commited = false;
try {
@@ -10446,17 +10457,22 @@ public class ObjectStore implements RawStore, Configurable {
if (pool.isSetQueryParallelism()) {
mPool.setQueryParallelism(pool.getQueryParallelism());
}
- if (pool.isSetSchedulingPolicy()) {
- String policy = pool.getSchedulingPolicy();
- if (!MetaStoreUtils.isValidSchedulingPolicy(policy)) {
- throw new InvalidOperationException("Invalid scheduling policy " + policy);
+ if (pool.isSetIsSetSchedulingPolicy() && pool.isIsSetSchedulingPolicy()) {
+ if (pool.isSetSchedulingPolicy()) {
+ String policy = pool.getSchedulingPolicy();
+ if (!MetaStoreUtils.isValidSchedulingPolicy(policy)) {
+ throw new InvalidOperationException("Invalid scheduling policy " + policy);
+ }
+ mPool.setSchedulingPolicy(pool.getSchedulingPolicy());
+ } else {
+ mPool.setSchedulingPolicy(null);
}
- mPool.setSchedulingPolicy(pool.getSchedulingPolicy());
}
if (pool.isSetPoolPath() && !pool.getPoolPath().equals(mPool.getPath())) {
moveDescendents(resourcePlan, mPool.getPath(), pool.getPoolPath());
mPool.setPath(pool.getPoolPath());
}
+
commited = commitTransaction();
} finally {
rollbackAndCleanup(commited, (Query)null);
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
index e5092ba..f4eff4c 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
@@ -58,6 +58,8 @@ import org.apache.hadoop.hive.metastore.api.PartitionValuesResponse;
import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
import org.apache.hadoop.hive.metastore.api.PrincipalType;
import org.apache.hadoop.hive.metastore.api.PrivilegeBag;
+import org.apache.hadoop.hive.metastore.api.WMNullablePool;
+import org.apache.hadoop.hive.metastore.api.WMNullableResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMTrigger;
import org.apache.hadoop.hive.metastore.api.Role;
@@ -762,7 +764,7 @@ public interface RawStore extends Configurable {
List<WMResourcePlan> getAllResourcePlans() throws MetaException;
- WMFullResourcePlan alterResourcePlan(String name, WMResourcePlan resourcePlan,
+ WMFullResourcePlan alterResourcePlan(String name, WMNullableResourcePlan resourcePlan,
boolean canActivateDisabled, boolean canDeactivate, boolean isReplace)
throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException,
MetaException;
@@ -790,7 +792,7 @@ public interface RawStore extends Configurable {
void createPool(WMPool pool) throws AlreadyExistsException, NoSuchObjectException,
InvalidOperationException, MetaException;
- void alterPool(WMPool pool, String poolPath) throws AlreadyExistsException,
+ void alterPool(WMNullablePool pool, String poolPath) throws AlreadyExistsException,
NoSuchObjectException, InvalidOperationException, MetaException;
void dropWMPool(String resourcePlanName, String poolPath)
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
index e28e44a..5598540 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.hive.metastore.cache;
import org.apache.hadoop.hive.metastore.api.WMFullResourcePlan;
+
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
@@ -34,6 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.common.StatsSetupConst;
@@ -74,6 +76,8 @@ import org.apache.hadoop.hive.metastore.api.PartitionValuesResponse;
import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
import org.apache.hadoop.hive.metastore.api.PrincipalType;
import org.apache.hadoop.hive.metastore.api.PrivilegeBag;
+import org.apache.hadoop.hive.metastore.api.WMNullablePool;
+import org.apache.hadoop.hive.metastore.api.WMNullableResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMTrigger;
import org.apache.hadoop.hive.metastore.cache.SharedCache.StatsType;
@@ -105,6 +109,7 @@ import org.apache.hadoop.hive.metastore.utils.StringUtils;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import com.google.common.annotations.VisibleForTesting;
// TODO filter->expr
@@ -2615,7 +2620,7 @@ public class CachedStore implements RawStore, Configurable {
}
@Override
- public WMFullResourcePlan alterResourcePlan(String name, WMResourcePlan resourcePlan,
+ public WMFullResourcePlan alterResourcePlan(String name, WMNullableResourcePlan resourcePlan,
boolean canActivateDisabled, boolean canDeactivate, boolean isReplace)
throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException,
MetaException {
@@ -2671,7 +2676,7 @@ public class CachedStore implements RawStore, Configurable {
}
@Override
- public void alterPool(WMPool pool, String poolPath) throws AlreadyExistsException,
+ public void alterPool(WMNullablePool pool, String poolPath) throws AlreadyExistsException,
NoSuchObjectException, InvalidOperationException, MetaException {
rawStore.alterPool(pool, poolPath);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/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 ff7636f..b77afac 100644
--- a/standalone-metastore/src/main/thrift/hive_metastore.thrift
+++ b/standalone-metastore/src/main/thrift/hive_metastore.thrift
@@ -1073,6 +1073,15 @@ struct WMResourcePlan {
4: optional string defaultPoolPath;
}
+struct WMNullableResourcePlan {
+ 1: required string name;
+ 2: optional WMResourcePlanStatus status;
+ 4: optional i32 queryParallelism;
+ 5: optional bool isSetQueryParallelism;
+ 6: optional string defaultPoolPath;
+ 7: optional bool isSetDefaultPoolPath;
+}
+
struct WMPool {
1: required string resourcePlanName;
2: required string poolPath;
@@ -1081,6 +1090,16 @@ struct WMPool {
5: optional string schedulingPolicy;
}
+
+struct WMNullablePool {
+ 1: required string resourcePlanName;
+ 2: required string poolPath;
+ 3: optional double allocFraction;
+ 4: optional i32 queryParallelism;
+ 5: optional string schedulingPolicy;
+ 6: optional bool isSetSchedulingPolicy;
+}
+
struct WMTrigger {
1: required string resourcePlanName;
2: required string triggerName;
@@ -1144,7 +1163,7 @@ struct WMGetAllResourcePlanResponse {
struct WMAlterResourcePlanRequest {
1: optional string resourcePlanName;
- 2: optional WMResourcePlan resourcePlan;
+ 2: optional WMNullableResourcePlan resourcePlan;
3: optional bool isEnableAndActivate;
4: optional bool isForceDeactivate;
5: optional bool isReplace;
@@ -1207,7 +1226,7 @@ struct WMCreatePoolResponse {
}
struct WMAlterPoolRequest {
- 1: optional WMPool pool;
+ 1: optional WMNullablePool pool;
2: optional string poolPath;
}
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java
index 877899c..e0a67bc 100644
--- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java
+++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java
@@ -55,6 +55,8 @@ import org.apache.hadoop.hive.metastore.api.PartitionValuesResponse;
import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
import org.apache.hadoop.hive.metastore.api.PrincipalType;
import org.apache.hadoop.hive.metastore.api.PrivilegeBag;
+import org.apache.hadoop.hive.metastore.api.WMNullablePool;
+import org.apache.hadoop.hive.metastore.api.WMNullableResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMTrigger;
import org.apache.hadoop.hive.metastore.api.Role;
@@ -958,7 +960,7 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable {
}
@Override
- public WMFullResourcePlan alterResourcePlan(String name, WMResourcePlan resourcePlan,
+ public WMFullResourcePlan alterResourcePlan(String name, WMNullableResourcePlan resourcePlan,
boolean canActivateDisabled, boolean canDeactivate, boolean isReplace)
throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException,
MetaException {
@@ -1014,7 +1016,7 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable {
}
@Override
- public void alterPool(WMPool pool, String poolPath) throws AlreadyExistsException,
+ public void alterPool(WMNullablePool pool, String poolPath) throws AlreadyExistsException,
NoSuchObjectException, InvalidOperationException, MetaException {
objectStore.alterPool(pool, poolPath);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/900da829/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java
index 6aa5d95..aad2914 100644
--- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java
+++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java
@@ -53,6 +53,8 @@ import org.apache.hadoop.hive.metastore.api.PartitionValuesResponse;
import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
import org.apache.hadoop.hive.metastore.api.PrincipalType;
import org.apache.hadoop.hive.metastore.api.PrivilegeBag;
+import org.apache.hadoop.hive.metastore.api.WMNullablePool;
+import org.apache.hadoop.hive.metastore.api.WMNullableResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMResourcePlan;
import org.apache.hadoop.hive.metastore.api.WMTrigger;
import org.apache.hadoop.hive.metastore.api.Role;
@@ -970,7 +972,7 @@ public class DummyRawStoreForJdoConnection implements RawStore {
@Override
public WMFullResourcePlan alterResourcePlan(
- String name, WMResourcePlan resourcePlan, boolean canActivateDisabled, boolean canDeactivate,
+ String name, WMNullableResourcePlan resourcePlan, boolean canActivateDisabled, boolean canDeactivate,
boolean isReplace)
throws NoSuchObjectException, InvalidOperationException, MetaException {
return null;
@@ -1017,7 +1019,7 @@ public class DummyRawStoreForJdoConnection implements RawStore {
}
@Override
- public void alterPool(WMPool pool, String poolPath) throws AlreadyExistsException,
+ public void alterPool(WMNullablePool pool, String poolPath) throws AlreadyExistsException,
NoSuchObjectException, InvalidOperationException, MetaException {
}