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 2017/11/27 22:27:56 UTC
[02/13] hive git commit: HIVE-17954 : Implement pool, user,
group and trigger to pool management API's (Harish Jaiprakash,
reviewed by Sergey Shelukhin)
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/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 7d7d28d..68d6c9c 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
@@ -14763,7 +14763,7 @@ class WMMapping:
- resourcePlanName
- entityType
- entityName
- - poolName
+ - poolPath
- ordering
"""
@@ -14772,15 +14772,15 @@ class WMMapping:
(1, TType.STRING, 'resourcePlanName', None, None, ), # 1
(2, TType.STRING, 'entityType', None, None, ), # 2
(3, TType.STRING, 'entityName', None, None, ), # 3
- (4, TType.STRING, 'poolName', None, None, ), # 4
+ (4, TType.STRING, 'poolPath', None, None, ), # 4
(5, TType.I32, 'ordering', None, None, ), # 5
)
- def __init__(self, resourcePlanName=None, entityType=None, entityName=None, poolName=None, ordering=None,):
+ def __init__(self, resourcePlanName=None, entityType=None, entityName=None, poolPath=None, ordering=None,):
self.resourcePlanName = resourcePlanName
self.entityType = entityType
self.entityName = entityName
- self.poolName = poolName
+ self.poolPath = poolPath
self.ordering = ordering
def read(self, iprot):
@@ -14809,7 +14809,7 @@ class WMMapping:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
- self.poolName = iprot.readString()
+ self.poolPath = iprot.readString()
else:
iprot.skip(ftype)
elif fid == 5:
@@ -14839,9 +14839,9 @@ class WMMapping:
oprot.writeFieldBegin('entityName', TType.STRING, 3)
oprot.writeString(self.entityName)
oprot.writeFieldEnd()
- if self.poolName is not None:
- oprot.writeFieldBegin('poolName', TType.STRING, 4)
- oprot.writeString(self.poolName)
+ if self.poolPath is not None:
+ oprot.writeFieldBegin('poolPath', TType.STRING, 4)
+ oprot.writeString(self.poolPath)
oprot.writeFieldEnd()
if self.ordering is not None:
oprot.writeFieldBegin('ordering', TType.I32, 5)
@@ -14865,7 +14865,7 @@ class WMMapping:
value = (value * 31) ^ hash(self.resourcePlanName)
value = (value * 31) ^ hash(self.entityType)
value = (value * 31) ^ hash(self.entityName)
- value = (value * 31) ^ hash(self.poolName)
+ value = (value * 31) ^ hash(self.poolPath)
value = (value * 31) ^ hash(self.ordering)
return value
@@ -16481,6 +16481,754 @@ class WMGetTriggersForResourePlanResponse:
def __ne__(self, other):
return not (self == other)
+class WMCreatePoolRequest:
+ """
+ Attributes:
+ - pool
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'pool', (WMPool, WMPool.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, pool=None,):
+ self.pool = pool
+
+ 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.STRUCT:
+ self.pool = WMPool()
+ self.pool.read(iprot)
+ 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('WMCreatePoolRequest')
+ if self.pool is not None:
+ oprot.writeFieldBegin('pool', TType.STRUCT, 1)
+ self.pool.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.pool)
+ 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 WMCreatePoolResponse:
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('WMCreatePoolResponse')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ 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 WMAlterPoolRequest:
+ """
+ Attributes:
+ - pool
+ - poolPath
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'pool', (WMPool, WMPool.thrift_spec), None, ), # 1
+ (2, TType.STRING, 'poolPath', None, None, ), # 2
+ )
+
+ def __init__(self, pool=None, poolPath=None,):
+ self.pool = pool
+ self.poolPath = poolPath
+
+ 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.STRUCT:
+ self.pool = WMPool()
+ self.pool.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.poolPath = iprot.readString()
+ 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('WMAlterPoolRequest')
+ if self.pool is not None:
+ oprot.writeFieldBegin('pool', TType.STRUCT, 1)
+ self.pool.write(oprot)
+ oprot.writeFieldEnd()
+ if self.poolPath is not None:
+ oprot.writeFieldBegin('poolPath', TType.STRING, 2)
+ oprot.writeString(self.poolPath)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.pool)
+ value = (value * 31) ^ hash(self.poolPath)
+ 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 WMAlterPoolResponse:
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('WMAlterPoolResponse')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ 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 WMDropPoolRequest:
+ """
+ Attributes:
+ - resourcePlanName
+ - poolPath
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'resourcePlanName', None, None, ), # 1
+ (2, TType.STRING, 'poolPath', None, None, ), # 2
+ )
+
+ def __init__(self, resourcePlanName=None, poolPath=None,):
+ self.resourcePlanName = resourcePlanName
+ self.poolPath = poolPath
+
+ 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)
+ 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('WMDropPoolRequest')
+ 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()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.resourcePlanName)
+ value = (value * 31) ^ hash(self.poolPath)
+ 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 WMDropPoolResponse:
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('WMDropPoolResponse')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ 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 WMCreateOrUpdateMappingRequest:
+ """
+ Attributes:
+ - mapping
+ - update
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'mapping', (WMMapping, WMMapping.thrift_spec), None, ), # 1
+ (2, TType.BOOL, 'update', None, None, ), # 2
+ )
+
+ def __init__(self, mapping=None, update=None,):
+ self.mapping = mapping
+ self.update = update
+
+ 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.STRUCT:
+ self.mapping = WMMapping()
+ self.mapping.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.BOOL:
+ self.update = 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('WMCreateOrUpdateMappingRequest')
+ if self.mapping is not None:
+ oprot.writeFieldBegin('mapping', TType.STRUCT, 1)
+ self.mapping.write(oprot)
+ oprot.writeFieldEnd()
+ if self.update is not None:
+ oprot.writeFieldBegin('update', TType.BOOL, 2)
+ oprot.writeBool(self.update)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.mapping)
+ value = (value * 31) ^ hash(self.update)
+ 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 WMCreateOrUpdateMappingResponse:
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('WMCreateOrUpdateMappingResponse')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ 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 WMDropMappingRequest:
+ """
+ Attributes:
+ - mapping
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'mapping', (WMMapping, WMMapping.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, mapping=None,):
+ self.mapping = mapping
+
+ 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.STRUCT:
+ self.mapping = WMMapping()
+ self.mapping.read(iprot)
+ 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('WMDropMappingRequest')
+ if self.mapping is not None:
+ oprot.writeFieldBegin('mapping', TType.STRUCT, 1)
+ self.mapping.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.mapping)
+ 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 WMDropMappingResponse:
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('WMDropMappingResponse')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ 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 WMCreateOrDropTriggerToPoolMappingRequest:
+ """
+ Attributes:
+ - resourcePlanName
+ - triggerName
+ - poolPath
+ - drop
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'resourcePlanName', None, None, ), # 1
+ (2, TType.STRING, 'triggerName', None, None, ), # 2
+ (3, TType.STRING, 'poolPath', None, None, ), # 3
+ (4, TType.BOOL, 'drop', None, None, ), # 4
+ )
+
+ def __init__(self, resourcePlanName=None, triggerName=None, poolPath=None, drop=None,):
+ self.resourcePlanName = resourcePlanName
+ self.triggerName = triggerName
+ self.poolPath = poolPath
+ self.drop = drop
+
+ 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.triggerName = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.STRING:
+ self.poolPath = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.BOOL:
+ self.drop = 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('WMCreateOrDropTriggerToPoolMappingRequest')
+ if self.resourcePlanName is not None:
+ oprot.writeFieldBegin('resourcePlanName', TType.STRING, 1)
+ oprot.writeString(self.resourcePlanName)
+ oprot.writeFieldEnd()
+ if self.triggerName is not None:
+ oprot.writeFieldBegin('triggerName', TType.STRING, 2)
+ oprot.writeString(self.triggerName)
+ oprot.writeFieldEnd()
+ if self.poolPath is not None:
+ oprot.writeFieldBegin('poolPath', TType.STRING, 3)
+ oprot.writeString(self.poolPath)
+ oprot.writeFieldEnd()
+ if self.drop is not None:
+ oprot.writeFieldBegin('drop', TType.BOOL, 4)
+ oprot.writeBool(self.drop)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.resourcePlanName)
+ value = (value * 31) ^ hash(self.triggerName)
+ value = (value * 31) ^ hash(self.poolPath)
+ value = (value * 31) ^ hash(self.drop)
+ 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 WMCreateOrDropTriggerToPoolMappingResponse:
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('WMCreateOrDropTriggerToPoolMappingResponse')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ 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 MetaException(TException):
"""
Attributes:
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/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 192f881..cc57c85 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
@@ -3334,14 +3334,14 @@ class WMMapping
RESOURCEPLANNAME = 1
ENTITYTYPE = 2
ENTITYNAME = 3
- POOLNAME = 4
+ POOLPATH = 4
ORDERING = 5
FIELDS = {
RESOURCEPLANNAME => {:type => ::Thrift::Types::STRING, :name => 'resourcePlanName'},
ENTITYTYPE => {:type => ::Thrift::Types::STRING, :name => 'entityType'},
ENTITYNAME => {:type => ::Thrift::Types::STRING, :name => 'entityName'},
- POOLNAME => {:type => ::Thrift::Types::STRING, :name => 'poolName', :optional => true},
+ POOLPATH => {:type => ::Thrift::Types::STRING, :name => 'poolPath', :optional => true},
ORDERING => {:type => ::Thrift::Types::I32, :name => 'ordering', :optional => true}
}
@@ -3753,6 +3753,204 @@ class WMGetTriggersForResourePlanResponse
::Thrift::Struct.generate_accessors self
end
+class WMCreatePoolRequest
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ POOL = 1
+
+ FIELDS = {
+ POOL => {:type => ::Thrift::Types::STRUCT, :name => 'pool', :class => ::WMPool, :optional => true}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMCreatePoolResponse
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+
+ FIELDS = {
+
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMAlterPoolRequest
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ POOL = 1
+ POOLPATH = 2
+
+ FIELDS = {
+ POOL => {:type => ::Thrift::Types::STRUCT, :name => 'pool', :class => ::WMPool, :optional => true},
+ POOLPATH => {:type => ::Thrift::Types::STRING, :name => 'poolPath', :optional => true}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMAlterPoolResponse
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+
+ FIELDS = {
+
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMDropPoolRequest
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ RESOURCEPLANNAME = 1
+ POOLPATH = 2
+
+ FIELDS = {
+ RESOURCEPLANNAME => {:type => ::Thrift::Types::STRING, :name => 'resourcePlanName', :optional => true},
+ POOLPATH => {:type => ::Thrift::Types::STRING, :name => 'poolPath', :optional => true}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMDropPoolResponse
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+
+ FIELDS = {
+
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMCreateOrUpdateMappingRequest
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ MAPPING = 1
+ UPDATE = 2
+
+ FIELDS = {
+ MAPPING => {:type => ::Thrift::Types::STRUCT, :name => 'mapping', :class => ::WMMapping, :optional => true},
+ UPDATE => {:type => ::Thrift::Types::BOOL, :name => 'update', :optional => true}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMCreateOrUpdateMappingResponse
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+
+ FIELDS = {
+
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMDropMappingRequest
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ MAPPING = 1
+
+ FIELDS = {
+ MAPPING => {:type => ::Thrift::Types::STRUCT, :name => 'mapping', :class => ::WMMapping, :optional => true}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMDropMappingResponse
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+
+ FIELDS = {
+
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMCreateOrDropTriggerToPoolMappingRequest
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ RESOURCEPLANNAME = 1
+ TRIGGERNAME = 2
+ POOLPATH = 3
+ DROP = 4
+
+ FIELDS = {
+ RESOURCEPLANNAME => {:type => ::Thrift::Types::STRING, :name => 'resourcePlanName', :optional => true},
+ TRIGGERNAME => {:type => ::Thrift::Types::STRING, :name => 'triggerName', :optional => true},
+ POOLPATH => {:type => ::Thrift::Types::STRING, :name => 'poolPath', :optional => true},
+ DROP => {:type => ::Thrift::Types::BOOL, :name => 'drop', :optional => true}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
+class WMCreateOrDropTriggerToPoolMappingResponse
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+
+ FIELDS = {
+
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
class MetaException < ::Thrift::Exception
include ::Thrift::Struct, ::Thrift::Struct_Union
def initialize(message=nil)
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb b/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
index 9fd7045..182cc37 100644
--- a/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
+++ b/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
@@ -2885,6 +2885,118 @@ module ThriftHiveMetastore
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_triggers_for_resourceplan failed: unknown result')
end
+ def create_wm_pool(request)
+ send_create_wm_pool(request)
+ return recv_create_wm_pool()
+ end
+
+ def send_create_wm_pool(request)
+ send_message('create_wm_pool', Create_wm_pool_args, :request => request)
+ end
+
+ def recv_create_wm_pool()
+ result = receive_message(Create_wm_pool_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise result.o2 unless result.o2.nil?
+ raise result.o3 unless result.o3.nil?
+ raise result.o4 unless result.o4.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'create_wm_pool failed: unknown result')
+ end
+
+ def alter_wm_pool(request)
+ send_alter_wm_pool(request)
+ return recv_alter_wm_pool()
+ end
+
+ def send_alter_wm_pool(request)
+ send_message('alter_wm_pool', Alter_wm_pool_args, :request => request)
+ end
+
+ def recv_alter_wm_pool()
+ result = receive_message(Alter_wm_pool_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise result.o2 unless result.o2.nil?
+ raise result.o3 unless result.o3.nil?
+ raise result.o4 unless result.o4.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'alter_wm_pool failed: unknown result')
+ end
+
+ def drop_wm_pool(request)
+ send_drop_wm_pool(request)
+ return recv_drop_wm_pool()
+ end
+
+ def send_drop_wm_pool(request)
+ send_message('drop_wm_pool', Drop_wm_pool_args, :request => request)
+ end
+
+ def recv_drop_wm_pool()
+ result = receive_message(Drop_wm_pool_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise result.o2 unless result.o2.nil?
+ raise result.o3 unless result.o3.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'drop_wm_pool failed: unknown result')
+ end
+
+ def create_or_update_wm_mapping(request)
+ send_create_or_update_wm_mapping(request)
+ return recv_create_or_update_wm_mapping()
+ end
+
+ def send_create_or_update_wm_mapping(request)
+ send_message('create_or_update_wm_mapping', Create_or_update_wm_mapping_args, :request => request)
+ end
+
+ def recv_create_or_update_wm_mapping()
+ result = receive_message(Create_or_update_wm_mapping_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise result.o2 unless result.o2.nil?
+ raise result.o3 unless result.o3.nil?
+ raise result.o4 unless result.o4.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'create_or_update_wm_mapping failed: unknown result')
+ end
+
+ def drop_wm_mapping(request)
+ send_drop_wm_mapping(request)
+ return recv_drop_wm_mapping()
+ end
+
+ def send_drop_wm_mapping(request)
+ send_message('drop_wm_mapping', Drop_wm_mapping_args, :request => request)
+ end
+
+ def recv_drop_wm_mapping()
+ result = receive_message(Drop_wm_mapping_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise result.o2 unless result.o2.nil?
+ raise result.o3 unless result.o3.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'drop_wm_mapping failed: unknown result')
+ end
+
+ def create_or_drop_wm_trigger_to_pool_mapping(request)
+ send_create_or_drop_wm_trigger_to_pool_mapping(request)
+ return recv_create_or_drop_wm_trigger_to_pool_mapping()
+ end
+
+ def send_create_or_drop_wm_trigger_to_pool_mapping(request)
+ send_message('create_or_drop_wm_trigger_to_pool_mapping', Create_or_drop_wm_trigger_to_pool_mapping_args, :request => request)
+ end
+
+ def recv_create_or_drop_wm_trigger_to_pool_mapping()
+ result = receive_message(Create_or_drop_wm_trigger_to_pool_mapping_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise result.o2 unless result.o2.nil?
+ raise result.o3 unless result.o3.nil?
+ raise result.o4 unless result.o4.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'create_or_drop_wm_trigger_to_pool_mapping failed: unknown result')
+ end
+
end
class Processor < ::FacebookService::Processor
@@ -5029,6 +5141,104 @@ module ThriftHiveMetastore
write_result(result, oprot, 'get_triggers_for_resourceplan', seqid)
end
+ def process_create_wm_pool(seqid, iprot, oprot)
+ args = read_args(iprot, Create_wm_pool_args)
+ result = Create_wm_pool_result.new()
+ begin
+ result.success = @handler.create_wm_pool(args.request)
+ rescue ::AlreadyExistsException => o1
+ result.o1 = o1
+ rescue ::NoSuchObjectException => o2
+ result.o2 = o2
+ rescue ::InvalidObjectException => o3
+ result.o3 = o3
+ rescue ::MetaException => o4
+ result.o4 = o4
+ end
+ write_result(result, oprot, 'create_wm_pool', seqid)
+ end
+
+ def process_alter_wm_pool(seqid, iprot, oprot)
+ args = read_args(iprot, Alter_wm_pool_args)
+ result = Alter_wm_pool_result.new()
+ begin
+ result.success = @handler.alter_wm_pool(args.request)
+ rescue ::AlreadyExistsException => o1
+ result.o1 = o1
+ rescue ::NoSuchObjectException => o2
+ result.o2 = o2
+ rescue ::InvalidObjectException => o3
+ result.o3 = o3
+ rescue ::MetaException => o4
+ result.o4 = o4
+ end
+ write_result(result, oprot, 'alter_wm_pool', seqid)
+ end
+
+ def process_drop_wm_pool(seqid, iprot, oprot)
+ args = read_args(iprot, Drop_wm_pool_args)
+ result = Drop_wm_pool_result.new()
+ begin
+ result.success = @handler.drop_wm_pool(args.request)
+ rescue ::NoSuchObjectException => o1
+ result.o1 = o1
+ rescue ::InvalidOperationException => o2
+ result.o2 = o2
+ rescue ::MetaException => o3
+ result.o3 = o3
+ end
+ write_result(result, oprot, 'drop_wm_pool', seqid)
+ end
+
+ def process_create_or_update_wm_mapping(seqid, iprot, oprot)
+ args = read_args(iprot, Create_or_update_wm_mapping_args)
+ result = Create_or_update_wm_mapping_result.new()
+ begin
+ result.success = @handler.create_or_update_wm_mapping(args.request)
+ rescue ::AlreadyExistsException => o1
+ result.o1 = o1
+ rescue ::NoSuchObjectException => o2
+ result.o2 = o2
+ rescue ::InvalidObjectException => o3
+ result.o3 = o3
+ rescue ::MetaException => o4
+ result.o4 = o4
+ end
+ write_result(result, oprot, 'create_or_update_wm_mapping', seqid)
+ end
+
+ def process_drop_wm_mapping(seqid, iprot, oprot)
+ args = read_args(iprot, Drop_wm_mapping_args)
+ result = Drop_wm_mapping_result.new()
+ begin
+ result.success = @handler.drop_wm_mapping(args.request)
+ rescue ::NoSuchObjectException => o1
+ result.o1 = o1
+ rescue ::InvalidOperationException => o2
+ result.o2 = o2
+ rescue ::MetaException => o3
+ result.o3 = o3
+ end
+ write_result(result, oprot, 'drop_wm_mapping', seqid)
+ end
+
+ def process_create_or_drop_wm_trigger_to_pool_mapping(seqid, iprot, oprot)
+ args = read_args(iprot, Create_or_drop_wm_trigger_to_pool_mapping_args)
+ result = Create_or_drop_wm_trigger_to_pool_mapping_result.new()
+ begin
+ result.success = @handler.create_or_drop_wm_trigger_to_pool_mapping(args.request)
+ rescue ::AlreadyExistsException => o1
+ result.o1 = o1
+ rescue ::NoSuchObjectException => o2
+ result.o2 = o2
+ rescue ::InvalidObjectException => o3
+ result.o3 = o3
+ rescue ::MetaException => o4
+ result.o4 = o4
+ end
+ write_result(result, oprot, 'create_or_drop_wm_trigger_to_pool_mapping', seqid)
+ end
+
end
# HELPER FUNCTIONS AND STRUCTURES
@@ -11490,5 +11700,241 @@ module ThriftHiveMetastore
::Thrift::Struct.generate_accessors self
end
+ class Create_wm_pool_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ REQUEST = 1
+
+ FIELDS = {
+ REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ::WMCreatePoolRequest}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Create_wm_pool_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+ O2 = 2
+ O3 = 3
+ O4 = 4
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::WMCreatePoolResponse},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::AlreadyExistsException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::NoSuchObjectException},
+ O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::InvalidObjectException},
+ O4 => {:type => ::Thrift::Types::STRUCT, :name => 'o4', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Alter_wm_pool_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ REQUEST = 1
+
+ FIELDS = {
+ REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ::WMAlterPoolRequest}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Alter_wm_pool_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+ O2 = 2
+ O3 = 3
+ O4 = 4
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::WMAlterPoolResponse},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::AlreadyExistsException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::NoSuchObjectException},
+ O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::InvalidObjectException},
+ O4 => {:type => ::Thrift::Types::STRUCT, :name => 'o4', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Drop_wm_pool_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ REQUEST = 1
+
+ FIELDS = {
+ REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ::WMDropPoolRequest}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Drop_wm_pool_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+ O2 = 2
+ O3 = 3
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::WMDropPoolResponse},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::NoSuchObjectException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::InvalidOperationException},
+ O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Create_or_update_wm_mapping_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ REQUEST = 1
+
+ FIELDS = {
+ REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ::WMCreateOrUpdateMappingRequest}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Create_or_update_wm_mapping_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+ O2 = 2
+ O3 = 3
+ O4 = 4
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::WMCreateOrUpdateMappingResponse},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::AlreadyExistsException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::NoSuchObjectException},
+ O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::InvalidObjectException},
+ O4 => {:type => ::Thrift::Types::STRUCT, :name => 'o4', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Drop_wm_mapping_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ REQUEST = 1
+
+ FIELDS = {
+ REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ::WMDropMappingRequest}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Drop_wm_mapping_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+ O2 = 2
+ O3 = 3
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::WMDropMappingResponse},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::NoSuchObjectException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::InvalidOperationException},
+ O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Create_or_drop_wm_trigger_to_pool_mapping_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ REQUEST = 1
+
+ FIELDS = {
+ REQUEST => {:type => ::Thrift::Types::STRUCT, :name => 'request', :class => ::WMCreateOrDropTriggerToPoolMappingRequest}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Create_or_drop_wm_trigger_to_pool_mapping_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+ O2 = 2
+ O3 = 3
+ O4 = 4
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::WMCreateOrDropTriggerToPoolMappingResponse},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::AlreadyExistsException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::NoSuchObjectException},
+ O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::InvalidObjectException},
+ O4 => {:type => ::Thrift::Types::STRUCT, :name => 'o4', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
end
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index 7a636aa..78efe38 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -7395,7 +7395,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
getMS().dropWMTrigger(request.getResourcePlanName(), request.getTriggerName());
return new WMDropTriggerResponse();
} catch (MetaException e) {
- LOG.error("Exception while trying to retrieve resource plans", e);
+ LOG.error("Exception while trying to drop trigger.", e);
throw e;
}
}
@@ -7414,6 +7414,88 @@ public class HiveMetaStore extends ThriftHiveMetastore {
throw e;
}
}
+
+ @Override
+ public WMCreatePoolResponse create_wm_pool(WMCreatePoolRequest request)
+ throws AlreadyExistsException, NoSuchObjectException, InvalidObjectException, MetaException,
+ TException {
+ try {
+ getMS().createPool(request.getPool());
+ return new WMCreatePoolResponse();
+ } catch (MetaException e) {
+ LOG.error("Exception while trying to create WMPool", e);
+ throw e;
+ }
+ }
+
+ @Override
+ public WMAlterPoolResponse alter_wm_pool(WMAlterPoolRequest request)
+ throws AlreadyExistsException, NoSuchObjectException, InvalidObjectException, MetaException,
+ TException {
+ try {
+ getMS().alterPool(request.getPool(), request.getPoolPath());
+ return new WMAlterPoolResponse();
+ } catch (MetaException e) {
+ LOG.error("Exception while trying to alter WMPool", e);
+ throw e;
+ }
+ }
+
+ @Override
+ public WMDropPoolResponse drop_wm_pool(WMDropPoolRequest request)
+ throws NoSuchObjectException, InvalidOperationException, MetaException, TException {
+ try {
+ getMS().dropWMPool(request.getResourcePlanName(), request.getPoolPath());
+ return new WMDropPoolResponse();
+ } catch (MetaException e) {
+ LOG.error("Exception while trying to drop WMPool", e);
+ throw e;
+ }
+ }
+
+ @Override
+ public WMCreateOrUpdateMappingResponse create_or_update_wm_mapping(
+ WMCreateOrUpdateMappingRequest request) throws AlreadyExistsException,
+ NoSuchObjectException, InvalidObjectException, MetaException, TException {
+ try {
+ getMS().createOrUpdateWMMapping(request.getMapping(), request.isUpdate());
+ return new WMCreateOrUpdateMappingResponse();
+ } catch (MetaException e) {
+ LOG.error("Exception while trying to create or update WMMapping", e);
+ throw e;
+ }
+ }
+
+ @Override
+ public WMDropMappingResponse drop_wm_mapping(WMDropMappingRequest request)
+ throws NoSuchObjectException, InvalidOperationException, MetaException, TException {
+ try {
+ getMS().dropWMMapping(request.getMapping());
+ return new WMDropMappingResponse();
+ } catch (MetaException e) {
+ LOG.error("Exception while trying to drop WMMapping", e);
+ throw e;
+ }
+ }
+
+ @Override
+ public WMCreateOrDropTriggerToPoolMappingResponse create_or_drop_wm_trigger_to_pool_mapping(
+ WMCreateOrDropTriggerToPoolMappingRequest request) throws AlreadyExistsException,
+ NoSuchObjectException, InvalidObjectException, MetaException, TException {
+ try {
+ if (request.isDrop()) {
+ getMS().dropWMTriggerToPoolMapping(
+ request.getResourcePlanName(), request.getTriggerName(), request.getPoolPath());
+ } else {
+ getMS().createWMTriggerToPoolMapping(
+ request.getResourcePlanName(), request.getTriggerName(), request.getPoolPath());
+ }
+ return new WMCreateOrDropTriggerToPoolMappingResponse();
+ } catch (MetaException e) {
+ LOG.error("Exception while trying to create or drop pool mappings", e);
+ throw e;
+ }
+ }
}
private static IHMSHandler newRetryingHMSHandler(IHMSHandler baseHandler, Configuration conf)
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/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 0dc8c39..63cb52e 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
@@ -25,6 +25,7 @@ import com.google.common.collect.Sets;
import org.apache.hadoop.hive.metastore.api.WMPoolTrigger;
import org.apache.hadoop.hive.metastore.api.WMMapping;
import org.apache.hadoop.hive.metastore.model.MWMMapping;
+import org.apache.hadoop.hive.metastore.model.MWMMapping.EntityType;
import org.apache.hadoop.hive.metastore.api.WMPool;
import org.apache.hadoop.hive.metastore.model.MWMPool;
import org.apache.hadoop.hive.metastore.api.WMFullResourcePlan;
@@ -9528,20 +9529,26 @@ public class ObjectStore implements RawStore, Configurable {
@Override
public void createResourcePlan(WMResourcePlan resourcePlan, int defaultPoolSize)
- throws AlreadyExistsException, MetaException {
+ throws AlreadyExistsException, InvalidObjectException, MetaException {
boolean commited = false;
String rpName = normalizeIdentifier(resourcePlan.getName());
Integer queryParallelism = resourcePlan.isSetQueryParallelism() ?
resourcePlan.getQueryParallelism() : null;
MWMResourcePlan rp = new MWMResourcePlan(
rpName, queryParallelism, MWMResourcePlan.Status.DISABLED);
+ if (rpName.isEmpty()) {
+ throw new InvalidObjectException("Resource name cannot be empty.");
+ }
+ if (queryParallelism != null && queryParallelism <= 0) {
+ throw new InvalidObjectException("Query parallelism should be positive.");
+ }
try {
openTransaction();
pm.makePersistent(rp);
// TODO: ideally, this should be moved outside to HiveMetaStore to be shared between
// all the RawStore-s. Right now there's no method to create a pool.
if (defaultPoolSize > 0) {
- MWMPool defaultPool = new MWMPool(rp, "default", null, 1.0, defaultPoolSize, null);
+ MWMPool defaultPool = new MWMPool(rp, "default", 1.0, defaultPoolSize, null);
pm.makePersistent(defaultPool);
rp.setPools(Sets.newHashSet(defaultPool));
rp.setDefaultPool(defaultPool);
@@ -9609,7 +9616,7 @@ public class ObjectStore implements RawStore, Configurable {
WMMapping result = new WMMapping(rpName,
mMapping.getEntityType().toString(), mMapping.getEntityName());
if (mMapping.getPool() != null) {
- result.setPoolName(mMapping.getPool().getPath());
+ result.setPoolPath(mMapping.getPool().getPath());
}
if (mMapping.getOrdering() != null) {
result.setOrdering(mMapping.getOrdering());
@@ -9619,10 +9626,16 @@ public class ObjectStore implements RawStore, Configurable {
@Override
public WMResourcePlan getResourcePlan(String name) throws NoSuchObjectException {
- return fromMResourcePlan(getMWMResourcePlan(name));
+ try {
+ return fromMResourcePlan(getMWMResourcePlan(name, false));
+ } catch (InvalidOperationException e) {
+ // Should not happen, edit check is false.
+ throw new RuntimeException(e);
+ }
}
- public MWMResourcePlan getMWMResourcePlan(String name) throws NoSuchObjectException {
+ private MWMResourcePlan getMWMResourcePlan(String name, boolean editCheck)
+ throws NoSuchObjectException, InvalidOperationException {
MWMResourcePlan resourcePlan;
boolean commited = false;
Query query = null;
@@ -9642,6 +9655,9 @@ public class ObjectStore implements RawStore, Configurable {
if (resourcePlan == null) {
throw new NoSuchObjectException("There is no resource plan named: " + name);
}
+ if (editCheck && resourcePlan.getStatus() != MWMResourcePlan.Status.DISABLED) {
+ throw new InvalidOperationException("Resource plan must be disabled to edit it.");
+ }
return resourcePlan;
}
@@ -9681,31 +9697,32 @@ public class ObjectStore implements RawStore, Configurable {
WMFullResourcePlan result = null;
try {
openTransaction();
- query = pm.newQuery(MWMResourcePlan.class, "name == rpName");
- query.declareParameters("java.lang.String rpName");
- query.setUnique(true);
- MWMResourcePlan mResourcePlan = (MWMResourcePlan) query.execute(name);
- if (mResourcePlan == null) {
- throw new NoSuchObjectException("Cannot find resource plan: " + name);
+ MWMResourcePlan mResourcePlan = getMWMResourcePlan(name, !resourcePlan.isSetStatus());
+ if (resourcePlan.isSetStatus() && (resourcePlan.isSetQueryParallelism() ||
+ resourcePlan.isSetDefaultPoolPath() || !resourcePlan.getName().equals(name))) {
+ throw new InvalidOperationException("Cannot change values during status switch.");
}
if (!resourcePlan.getName().equals(name)) {
+ String newName = normalizeIdentifier(resourcePlan.getName());
+ if (newName.isEmpty()) {
+ throw new InvalidOperationException("Cannot rename to empty value.");
+ }
mResourcePlan.setName(resourcePlan.getName());
}
if (resourcePlan.isSetQueryParallelism()) {
+ if (resourcePlan.getQueryParallelism() <= 0) {
+ throw new InvalidOperationException("queryParallelism should be positive.");
+ }
mResourcePlan.setQueryParallelism(resourcePlan.getQueryParallelism());
}
+ if (resourcePlan.isSetDefaultPoolPath()) {
+ MWMPool pool = getPool(mResourcePlan, resourcePlan.getDefaultPoolPath());
+ mResourcePlan.setDefaultPool(pool);
+ }
if (resourcePlan.isSetStatus()) {
result = switchStatus(
name, mResourcePlan, resourcePlan.getStatus().name(), canActivateDisabled);
}
- if (resourcePlan.isSetDefaultPoolPath()) {
- MWMPool pool = getPoolByPath(resourcePlan, resourcePlan.getDefaultPoolPath());
- if (pool == null) {
- throw new NoSuchObjectException(
- "Cannot find pool: " + resourcePlan.getDefaultPoolPath());
- }
- mResourcePlan.setDefaultPool(pool);
- }
commited = commitTransaction();
return result;
} catch (Exception e) {
@@ -9716,25 +9733,6 @@ public class ObjectStore implements RawStore, Configurable {
}
}
-
- private MWMPool getPoolByPath(WMResourcePlan parent, String path) {
- // Note: this doesn't do recursion because we will do that on create/alter.
- boolean commited = false;
- Query query = null;
- try {
- openTransaction();
- query = pm.newQuery(MWMPool.class, "path == pname and resourcePlan == rp");
- query.declareParameters("java.lang.String pname, MWMResourcePlan rp");
- query.setUnique(true);
- MWMPool pool = (MWMPool) query.execute(path, parent);
- pm.retrieve(pool);
- commited = commitTransaction();
- return pool;
- } finally {
- rollbackAndCleanup(commited, query);
- }
- }
-
@Override
public WMFullResourcePlan getActiveResourcePlan() throws MetaException {
boolean commited = false;
@@ -9893,11 +9891,7 @@ public class ObjectStore implements RawStore, Configurable {
boolean commited = false;
try {
openTransaction();
- MWMResourcePlan resourcePlan = getMWMResourcePlan(
- normalizeIdentifier(trigger.getResourcePlanName()));
- if (resourcePlan.getStatus() != MWMResourcePlan.Status.DISABLED) {
- throw new InvalidOperationException("Resource plan must be disabled to edit it.");
- }
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(trigger.getResourcePlanName(), true);
MWMTrigger mTrigger = new MWMTrigger(resourcePlan,
normalizeIdentifier(trigger.getTriggerName()), trigger.getTriggerExpression(),
trigger.getActionExpression(), null);
@@ -9918,23 +9912,35 @@ public class ObjectStore implements RawStore, Configurable {
Query query = null;
try {
openTransaction();
- MWMResourcePlan resourcePlan = getMWMResourcePlan(
- normalizeIdentifier(trigger.getResourcePlanName()));
- if (resourcePlan.getStatus() != MWMResourcePlan.Status.DISABLED) {
- throw new InvalidOperationException("Resource plan must be disabled to edit it.");
- }
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(trigger.getResourcePlanName(), true);
+ MWMTrigger mTrigger = getTrigger(resourcePlan, trigger.getTriggerName());
+ // Update the object.
+ mTrigger.setTriggerExpression(trigger.getTriggerExpression());
+ mTrigger.setActionExpression(trigger.getActionExpression());
+ commited = commitTransaction();
+ } finally {
+ rollbackAndCleanup(commited, query);
+ }
+ }
+ private MWMTrigger getTrigger(MWMResourcePlan resourcePlan, String triggerName)
+ throws NoSuchObjectException {
+ triggerName = normalizeIdentifier(triggerName);
+ boolean commited = false;
+ Query query = null;
+ try {
+ openTransaction();
// Get the MWMTrigger object from DN
query = pm.newQuery(MWMTrigger.class, "resourcePlan == rp && name == triggerName");
query.declareParameters("MWMResourcePlan rp, java.lang.String triggerName");
query.setUnique(true);
- MWMTrigger mTrigger = (MWMTrigger) query.execute(resourcePlan, trigger.getTriggerName());
+ MWMTrigger mTrigger = (MWMTrigger) query.execute(resourcePlan, triggerName);
+ if (mTrigger == null) {
+ throw new NoSuchObjectException("Cannot find trigger with name: " + triggerName);
+ }
pm.retrieve(mTrigger);
-
- // Update the object.
- mTrigger.setTriggerExpression(trigger.getTriggerExpression());
- mTrigger.setActionExpression(mTrigger.getActionExpression());
commited = commitTransaction();
+ return mTrigger;
} finally {
rollbackAndCleanup(commited, query);
}
@@ -9950,13 +9956,10 @@ public class ObjectStore implements RawStore, Configurable {
Query query = null;
try {
openTransaction();
- MWMResourcePlan resourcePlan = getMWMResourcePlan(resourcePlanName);
- if (resourcePlan.getStatus() != MWMResourcePlan.Status.DISABLED) {
- throw new InvalidOperationException("Resource plan must be disabled to edit it.");
- }
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(resourcePlanName, true);
query = pm.newQuery(MWMTrigger.class, "resourcePlan == rp && name == triggerName");
query.declareParameters("MWMResourcePlan rp, java.lang.String triggerName");
- if (query.deletePersistentAll(resourcePlan, triggerName) == 0) {
+ if (query.deletePersistentAll(resourcePlan, triggerName) != 1) {
throw new NoSuchObjectException("Cannot delete trigger: " + triggerName);
}
commited = commitTransaction();
@@ -9973,7 +9976,13 @@ public class ObjectStore implements RawStore, Configurable {
Query query = null;
try {
openTransaction();
- MWMResourcePlan resourcePlan = getMWMResourcePlan(resourcePlanName);
+ MWMResourcePlan resourcePlan;
+ try {
+ resourcePlan = getMWMResourcePlan(resourcePlanName, false);
+ } catch (InvalidOperationException e) {
+ // Should not happen, edit check is false.
+ throw new RuntimeException(e);
+ }
query = pm.newQuery(MWMTrigger.class, "resourcePlan == rp");
query.declareParameters("MWMResourcePlan rp");
List<MWMTrigger> mTriggers = (List<MWMTrigger>) query.execute(resourcePlan);
@@ -9998,4 +10007,249 @@ public class ObjectStore implements RawStore, Configurable {
trigger.setActionExpression(mTrigger.getActionExpression());
return trigger;
}
+
+ @Override
+ public void createPool(WMPool pool) throws AlreadyExistsException, NoSuchObjectException,
+ InvalidOperationException, MetaException {
+ boolean commited = false;
+ try {
+ openTransaction();
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(pool.getResourcePlanName(), true);
+
+ if (!poolParentExists(resourcePlan, pool.getPoolPath())) {
+ throw new NoSuchObjectException("Pool path is invalid, the parent does not exist");
+ }
+ MWMPool mPool = new MWMPool(resourcePlan, pool.getPoolPath(), pool.getAllocFraction(),
+ pool.getQueryParallelism(), pool.getSchedulingPolicy());
+ pm.makePersistent(mPool);
+ commited = commitTransaction();
+ } catch (Exception e) {
+ checkForConstraintException(e, "Pool already exists: ");
+ throw e;
+ } finally {
+ rollbackAndCleanup(commited, (Query)null);
+ }
+ }
+
+ @Override
+ public void alterPool(WMPool pool, String poolPath) throws AlreadyExistsException,
+ NoSuchObjectException, InvalidOperationException, MetaException {
+ boolean commited = false;
+ try {
+ openTransaction();
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(pool.getResourcePlanName(), true);
+ MWMPool mPool = getPool(resourcePlan, poolPath);
+ pm.retrieve(mPool);
+ if (pool.isSetAllocFraction()) {
+ mPool.setAllocFraction(pool.getAllocFraction());
+ }
+ if (pool.isSetQueryParallelism()) {
+ mPool.setQueryParallelism(pool.getQueryParallelism());
+ }
+ if (pool.isSetSchedulingPolicy()) {
+ 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);
+ }
+ }
+
+ private MWMPool getPool(MWMResourcePlan resourcePlan, String poolPath)
+ throws NoSuchObjectException {
+ poolPath = normalizeIdentifier(poolPath);
+ boolean commited = false;
+ Query query = null;
+ try {
+ openTransaction();
+ query = pm.newQuery(MWMPool.class, "resourcePlan == rp && path == poolPath");
+ query.declareParameters("MWMResourcePlan rp, java.lang.String poolPath");
+ query.setUnique(true);
+ MWMPool mPool = (MWMPool) query.execute(resourcePlan, poolPath);
+ commited = commitTransaction();
+ if (mPool == null) {
+ throw new NoSuchObjectException("Cannot find pool: " + poolPath);
+ }
+ pm.retrieve(mPool);
+ return mPool;
+ } finally {
+ rollbackAndCleanup(commited, query);
+ }
+ }
+
+ private void moveDescendents(MWMResourcePlan resourcePlan, String path, String newPoolPath)
+ throws NoSuchObjectException {
+ if (!poolParentExists(resourcePlan, newPoolPath)) {
+ throw new NoSuchObjectException("Pool path is invalid, the parent does not exist");
+ }
+ boolean commited = false;
+ Query query = null;
+ openTransaction();
+ try {
+ query = pm.newQuery(MWMPool.class, "resourcePlan == rp && path.startsWith(poolPath)");
+ query.declareParameters("MWMResourcePlan rp, java.lang.String poolPath");
+ List<MWMPool> descPools = (List<MWMPool>) query.execute(resourcePlan, path + ".");
+ pm.retrieveAll(descPools);
+ for (MWMPool pool : descPools) {
+ pool.setPath(newPoolPath + pool.getPath().substring(path.length()));
+ }
+ commited = commitTransaction();
+ } finally {
+ rollbackAndCleanup(commited, query);
+ }
+ }
+
+ private boolean poolParentExists(MWMResourcePlan resourcePlan, String poolPath) {
+ int idx = poolPath.lastIndexOf('.');
+ if (idx == -1) {
+ return true;
+ }
+ String parent = poolPath.substring(0, idx);
+ try {
+ getPool(resourcePlan, parent);
+ return true;
+ } catch (NoSuchObjectException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public void dropWMPool(String resourcePlanName, String poolPath)
+ throws NoSuchObjectException, InvalidOperationException, MetaException {
+ poolPath = normalizeIdentifier(poolPath);
+ boolean commited = false;
+ Query query = null;
+ try {
+ openTransaction();
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(resourcePlanName, true);
+ if (resourcePlan.getDefaultPool() != null &&
+ resourcePlan.getDefaultPool().getPath().equals(poolPath)) {
+ throw new InvalidOperationException("Cannot drop default pool of a resource plan");
+ }
+ if (poolHasChildren(resourcePlan, poolPath)) {
+ throw new InvalidOperationException("Pool has children cannot drop.");
+ }
+ query = pm.newQuery(MWMPool.class, "resourcePlan == rp && path.startsWith(poolPath)");
+ query.declareParameters("MWMResourcePlan rp, java.lang.String poolPath");
+ if (query.deletePersistentAll(resourcePlan, poolPath) != 1) {
+ throw new NoSuchObjectException("Cannot delete pool: " + poolPath);
+ }
+ commited = commitTransaction();
+ } finally {
+ rollbackAndCleanup(commited, query);
+ }
+ }
+
+ private boolean poolHasChildren(MWMResourcePlan resourcePlan, String poolPath) {
+ boolean commited = false;
+ Query query = null;
+ try {
+ openTransaction();
+ query = pm.newQuery(MWMPool.class, "resourcePlan == rp && path.startsWith(poolPath)");
+ query.declareParameters("MWMResourcePlan rp, java.lang.String poolPath");
+ query.setResult("count(this)");
+ query.setUnique(true);
+ Long count = (Long) query.execute(resourcePlan, poolPath + ".");
+ commited = commitTransaction();
+ return count != null && count > 0;
+ } finally {
+ rollbackAndCleanup(commited, query);
+ }
+ }
+
+ @Override
+ public void createOrUpdateWMMapping(WMMapping mapping, boolean update)
+ throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException,
+ MetaException {
+ EntityType entityType = EntityType.valueOf(mapping.getEntityType().trim().toUpperCase());
+ String entityName = normalizeIdentifier(mapping.getEntityName());
+ boolean commited = false;
+ Query query = null;
+ try {
+ openTransaction();
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(mapping.getResourcePlanName(), true);
+ MWMPool pool = getPool(resourcePlan, mapping.getPoolPath());
+ if (!update) {
+ MWMMapping mMapping = new MWMMapping(resourcePlan, entityType, entityName, pool,
+ mapping.getOrdering());
+ pm.makePersistent(mMapping);
+ } else {
+ query = pm.newQuery(MWMPool.class, "resourcePlan == rp && entityType == type " +
+ "&& entityName == name");
+ query.declareParameters(
+ "MWMResourcePlan rp, java.lang.String type, java.lang.String name");
+ query.setUnique(true);
+ MWMMapping mMapping = (MWMMapping) query.execute(resourcePlan, entityType, entityName);
+ mMapping.setPool(pool);
+ }
+ commited = commitTransaction();
+ } finally {
+ rollbackAndCleanup(commited, query);
+ }
+ }
+
+ @Override
+ public void dropWMMapping(WMMapping mapping)
+ throws NoSuchObjectException, InvalidOperationException, MetaException {
+ String entityType = mapping.getEntityType().trim().toUpperCase();
+ String entityName = normalizeIdentifier(mapping.getEntityName());
+ boolean commited = false;
+ Query query = null;
+ try {
+ openTransaction();
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(mapping.getResourcePlanName(), true);
+ query = pm.newQuery(MWMMapping.class,
+ "resourcePlan == rp && entityType == type && entityName == name");
+ query.declareParameters("MWMResourcePlan rp, java.lang.String type, java.lang.String name");
+ if (query.deletePersistentAll(resourcePlan, entityType, entityName) != 1) {
+ throw new NoSuchObjectException("Cannot delete mapping.");
+ }
+ commited = commitTransaction();
+ } finally {
+ rollbackAndCleanup(commited, query);
+ }
+ }
+
+ @Override
+ public void createWMTriggerToPoolMapping(String resourcePlanName, String triggerName,
+ String poolPath) throws AlreadyExistsException, NoSuchObjectException,
+ InvalidOperationException, MetaException {
+ boolean commited = false;
+ try {
+ openTransaction();
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(resourcePlanName, true);
+ MWMPool pool = getPool(resourcePlan, poolPath);
+ MWMTrigger trigger = getTrigger(resourcePlan, triggerName);
+ pool.getTriggers().add(trigger);
+ trigger.getPools().add(pool);
+ pm.makePersistent(pool);
+ pm.makePersistent(trigger);
+ commited = commitTransaction();
+ } finally {
+ rollbackAndCleanup(commited, (Query)null);
+ }
+ }
+
+ @Override
+ public void dropWMTriggerToPoolMapping(String resourcePlanName, String triggerName,
+ String poolPath) throws NoSuchObjectException, InvalidOperationException, MetaException {
+ boolean commited = false;
+ try {
+ openTransaction();
+ MWMResourcePlan resourcePlan = getMWMResourcePlan(resourcePlanName, true);
+ MWMPool pool = getPool(resourcePlan, poolPath);
+ MWMTrigger trigger = getTrigger(resourcePlan, triggerName);
+ pool.getTriggers().remove(trigger);
+ trigger.getPools().remove(pool);
+ pm.makePersistent(pool);
+ pm.makePersistent(trigger);
+ commited = commitTransaction();
+ } finally {
+ rollbackAndCleanup(commited, (Query)null);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/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 db148a1..dcc626c 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
@@ -72,6 +72,8 @@ import org.apache.hadoop.hive.metastore.api.Type;
import org.apache.hadoop.hive.metastore.api.UnknownDBException;
import org.apache.hadoop.hive.metastore.api.UnknownPartitionException;
import org.apache.hadoop.hive.metastore.api.UnknownTableException;
+import org.apache.hadoop.hive.metastore.api.WMMapping;
+import org.apache.hadoop.hive.metastore.api.WMPool;
import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
import org.apache.thrift.TException;
@@ -752,7 +754,7 @@ public interface RawStore extends Configurable {
String getMetastoreDbUuid() throws MetaException;
void createResourcePlan(WMResourcePlan resourcePlan, int defaultPoolSize)
- throws AlreadyExistsException, MetaException;
+ throws AlreadyExistsException, MetaException, InvalidObjectException;
WMResourcePlan getResourcePlan(String name) throws NoSuchObjectException, MetaException;
@@ -782,4 +784,27 @@ public interface RawStore extends Configurable {
List<WMTrigger> getTriggersForResourcePlan(String resourcePlanName)
throws NoSuchObjectException, MetaException;
+
+ void createPool(WMPool pool) throws AlreadyExistsException, NoSuchObjectException,
+ InvalidOperationException, MetaException;
+
+ void alterPool(WMPool pool, String poolPath) throws AlreadyExistsException,
+ NoSuchObjectException, InvalidOperationException, MetaException;
+
+ void dropWMPool(String resourcePlanName, String poolPath)
+ throws NoSuchObjectException, InvalidOperationException, MetaException;
+
+ void createOrUpdateWMMapping(WMMapping mapping, boolean update)
+ throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException,
+ MetaException;
+
+ void dropWMMapping(WMMapping mapping)
+ throws NoSuchObjectException, InvalidOperationException, MetaException;
+
+ void createWMTriggerToPoolMapping(String resourcePlanName, String triggerName, String poolPath)
+ throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException,
+ MetaException;
+
+ void dropWMTriggerToPoolMapping(String resourcePlanName, String triggerName, String poolPath)
+ throws NoSuchObjectException, InvalidOperationException, MetaException;
}
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/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 2eb967b..1f6d900 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
@@ -91,6 +91,8 @@ import org.apache.hadoop.hive.metastore.api.Type;
import org.apache.hadoop.hive.metastore.api.UnknownDBException;
import org.apache.hadoop.hive.metastore.api.UnknownPartitionException;
import org.apache.hadoop.hive.metastore.api.UnknownTableException;
+import org.apache.hadoop.hive.metastore.api.WMMapping;
+import org.apache.hadoop.hive.metastore.api.WMPool;
import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
import org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars;
import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
@@ -2382,7 +2384,7 @@ public class CachedStore implements RawStore, Configurable {
@Override
public void createResourcePlan(WMResourcePlan resourcePlan, int defaultPoolSize)
- throws AlreadyExistsException, MetaException {
+ throws AlreadyExistsException, InvalidObjectException, MetaException {
rawStore.createResourcePlan(resourcePlan, defaultPoolSize);
}
@@ -2445,6 +2447,50 @@ public class CachedStore implements RawStore, Configurable {
return rawStore.getTriggersForResourcePlan(resourcePlanName);
}
+ @Override
+ public void createPool(WMPool pool) throws AlreadyExistsException, NoSuchObjectException,
+ InvalidOperationException, MetaException {
+ rawStore.createPool(pool);
+ }
+
+ @Override
+ public void alterPool(WMPool pool, String poolPath) throws AlreadyExistsException,
+ NoSuchObjectException, InvalidOperationException, MetaException {
+ rawStore.alterPool(pool, poolPath);
+ }
+
+ @Override
+ public void dropWMPool(String resourcePlanName, String poolPath)
+ throws NoSuchObjectException, InvalidOperationException, MetaException {
+ rawStore.dropWMPool(resourcePlanName, poolPath);
+ }
+
+ @Override
+ public void createOrUpdateWMMapping(WMMapping mapping, boolean update)
+ throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException,
+ MetaException {
+ rawStore.createOrUpdateWMMapping(mapping, update);
+ }
+
+ @Override
+ public void dropWMMapping(WMMapping mapping)
+ throws NoSuchObjectException, InvalidOperationException, MetaException {
+ rawStore.dropWMMapping(mapping);
+ }
+
+ @Override
+ public void createWMTriggerToPoolMapping(String resourcePlanName, String triggerName,
+ String poolPath) throws AlreadyExistsException, NoSuchObjectException,
+ InvalidOperationException, MetaException {
+ rawStore.createWMTriggerToPoolMapping(resourcePlanName, triggerName, poolPath);
+ }
+
+ @Override
+ public void dropWMTriggerToPoolMapping(String resourcePlanName, String triggerName,
+ String poolPath) throws NoSuchObjectException, InvalidOperationException, MetaException {
+ rawStore.dropWMTriggerToPoolMapping(resourcePlanName, triggerName, poolPath);
+ }
+
static boolean isNotInBlackList(String dbName, String tblName) {
String str = dbName + "." + tblName;
for (Pattern pattern : blacklistPatterns) {
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MWMPool.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MWMPool.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MWMPool.java
index e00a020..01f2fe3 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MWMPool.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MWMPool.java
@@ -25,14 +25,13 @@ public class MWMPool {
private String path;
private Double allocFraction;
private Integer queryParallelism;
- private Set<MWMTrigger> triggers;
private String schedulingPolicy;
- private MWMPool parentPool;
+ private Set<MWMTrigger> triggers;
public MWMPool() {}
- public MWMPool(MWMResourcePlan resourcePlan, String path, MWMPool parentPool,
- Double allocFraction, Integer queryParallelism, String schedulingPolicy) {
+ public MWMPool(MWMResourcePlan resourcePlan, String path, Double allocFraction,
+ Integer queryParallelism, String schedulingPolicy) {
this.resourcePlan = resourcePlan;
this.path = path;
this.allocFraction = allocFraction;
@@ -72,14 +71,6 @@ public class MWMPool {
this.queryParallelism = queryParallelism;
}
- public Set<MWMTrigger> getTriggers() {
- return triggers;
- }
-
- public void setTriggers(Set<MWMTrigger> triggers) {
- this.triggers = triggers;
- }
-
public String getSchedulingPolicy() {
return schedulingPolicy;
}
@@ -88,11 +79,11 @@ public class MWMPool {
this.schedulingPolicy = schedulingPolicy;
}
- public MWMPool getParentPool() {
- return parentPool;
+ public Set<MWMTrigger> getTriggers() {
+ return triggers;
}
- public void setParentPool(MWMPool parentPool) {
- this.parentPool = parentPool;
+ public void setTriggers(Set<MWMTrigger> triggers) {
+ this.triggers = triggers;
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/standalone-metastore/src/main/resources/package.jdo
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/resources/package.jdo b/standalone-metastore/src/main/resources/package.jdo
index 3242630..57e75f8 100644
--- a/standalone-metastore/src/main/resources/package.jdo
+++ b/standalone-metastore/src/main/resources/package.jdo
@@ -1123,19 +1123,17 @@
<field name="path">
<column name="PATH" length="1024" jdbc-type="VARCHAR" allows-null="false"/>
</field>
- <field name="parentPool">
- <column name="PARENT_POOL_ID" jdbc-type="integer" allows-null="true" target="POOL_ID"/>
- </field>
<field name="allocFraction">
<column name="ALLOC_FRACTION" jdbc-type="double" allows-null="true"/>
</field>
- <field name="schedulingPolicy">
- <column name="SCHEDULING_POLICY" jdbc-type="VARCHAR" allows-null="true"/>
- </field>
<field name="queryParallelism">
<column name="QUERY_PARALLELISM" jdbc-type="integer" allows-null="true"/>
</field>
+ <field name="schedulingPolicy">
+ <column name="SCHEDULING_POLICY" jdbc-type="string" allows-null="true"/>
+ </field>
<field name="triggers" table="WM_POOL_TO_TRIGGER">
+ <collection element-type="MWMTrigger" />
<join>
<column name="POOL_ID" />
</join>
http://git-wip-us.apache.org/repos/asf/hive/blob/44ef5991/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 4832a6f..3319b1e 100644
--- a/standalone-metastore/src/main/thrift/hive_metastore.thrift
+++ b/standalone-metastore/src/main/thrift/hive_metastore.thrift
@@ -1065,7 +1065,7 @@ struct WMMapping {
1: required string resourcePlanName;
2: required string entityType;
3: required string entityName;
- 4: optional string poolName;
+ 4: optional string poolPath;
5: optional i32 ordering;
}
@@ -1168,6 +1168,53 @@ struct WMGetTriggersForResourePlanResponse {
1: optional list<WMTrigger> triggers;
}
+struct WMCreatePoolRequest {
+ 1: optional WMPool pool;
+}
+
+struct WMCreatePoolResponse {
+}
+
+struct WMAlterPoolRequest {
+ 1: optional WMPool pool;
+ 2: optional string poolPath;
+}
+
+struct WMAlterPoolResponse {
+}
+
+struct WMDropPoolRequest {
+ 1: optional string resourcePlanName;
+ 2: optional string poolPath;
+}
+
+struct WMDropPoolResponse {
+}
+
+struct WMCreateOrUpdateMappingRequest {
+ 1: optional WMMapping mapping;
+ 2: optional bool update;
+}
+
+struct WMCreateOrUpdateMappingResponse {
+}
+
+struct WMDropMappingRequest {
+ 1: optional WMMapping mapping;
+}
+
+struct WMDropMappingResponse {
+}
+
+struct WMCreateOrDropTriggerToPoolMappingRequest {
+ 1: optional string resourcePlanName;
+ 2: optional string triggerName;
+ 3: optional string poolPath;
+ 4: optional bool drop;
+}
+
+struct WMCreateOrDropTriggerToPoolMappingResponse {
+}
// Exceptions.
@@ -1767,6 +1814,24 @@ service ThriftHiveMetastore extends fb303.FacebookService
WMGetTriggersForResourePlanResponse get_triggers_for_resourceplan(1:WMGetTriggersForResourePlanRequest request)
throws(1:NoSuchObjectException o1, 2:MetaException o2)
+
+ WMCreatePoolResponse create_wm_pool(1:WMCreatePoolRequest request)
+ throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4)
+
+ WMAlterPoolResponse alter_wm_pool(1:WMAlterPoolRequest request)
+ throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4)
+
+ WMDropPoolResponse drop_wm_pool(1:WMDropPoolRequest request)
+ throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3)
+
+ WMCreateOrUpdateMappingResponse create_or_update_wm_mapping(1:WMCreateOrUpdateMappingRequest request)
+ throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4)
+
+ WMDropMappingResponse drop_wm_mapping(1:WMDropMappingRequest request)
+ throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3)
+
+ WMCreateOrDropTriggerToPoolMappingResponse create_or_drop_wm_trigger_to_pool_mapping(1:WMCreateOrDropTriggerToPoolMappingRequest request)
+ throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4)
}
// * Note about the DDL_TIME: When creating or altering a table or a partition,