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/02/02 02:03:40 UTC
[41/50] [abbrv] hive git commit: HIVE-14671 : merge master into
hive-14535 (Sergey Shelukhin) UNVERIFIED (build only)
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
----------------------------------------------------------------------
diff --cc metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
index 0609c11,2f1c3cf..9ce6f16
--- a/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
+++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
@@@ -3136,8 -3133,7 +3136,9 @@@ class Table
- tableType
- privileges
- temporary
+ - rewriteEnabled
+ - mmNextWriteId
+ - mmWatermarkWriteId
"""
thrift_spec = (
@@@ -3156,11 -3152,10 +3157,12 @@@
(12, TType.STRING, 'tableType', None, None, ), # 12
(13, TType.STRUCT, 'privileges', (PrincipalPrivilegeSet, PrincipalPrivilegeSet.thrift_spec), None, ), # 13
(14, TType.BOOL, 'temporary', None, False, ), # 14
- (15, TType.I64, 'mmNextWriteId', None, None, ), # 15
- (16, TType.I64, 'mmWatermarkWriteId', None, None, ), # 16
+ (15, TType.BOOL, 'rewriteEnabled', None, None, ), # 15
++ (16, TType.I64, 'mmNextWriteId', None, None, ), # 16
++ (17, TType.I64, 'mmWatermarkWriteId', None, None, ), # 17
)
- def __init__(self, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None, temporary=thrift_spec[14][4], mmNextWriteId=None, mmWatermarkWriteId=None,):
- def __init__(self, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None, temporary=thrift_spec[14][4], rewriteEnabled=None,):
++ def __init__(self, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None, temporary=thrift_spec[14][4], rewriteEnabled=None, mmNextWriteId=None, mmWatermarkWriteId=None,):
self.tableName = tableName
self.dbName = dbName
self.owner = owner
@@@ -3175,8 -3170,7 +3177,9 @@@
self.tableType = tableType
self.privileges = privileges
self.temporary = temporary
+ self.rewriteEnabled = rewriteEnabled
+ self.mmNextWriteId = mmNextWriteId
+ self.mmWatermarkWriteId = mmWatermarkWriteId
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:
@@@ -3272,15 -3266,10 +3275,20 @@@
else:
iprot.skip(ftype)
elif fid == 15:
+ if ftype == TType.BOOL:
+ self.rewriteEnabled = iprot.readBool()
+ else:
+ iprot.skip(ftype)
++ elif fid == 16:
+ if ftype == TType.I64:
+ self.mmNextWriteId = iprot.readI64()
+ else:
+ iprot.skip(ftype)
- elif fid == 16:
++ elif fid == 17:
+ if ftype == TType.I64:
+ self.mmWatermarkWriteId = iprot.readI64()
+ else:
+ iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
@@@ -3354,14 -3343,10 +3362,18 @@@
oprot.writeFieldBegin('temporary', TType.BOOL, 14)
oprot.writeBool(self.temporary)
oprot.writeFieldEnd()
+ if self.rewriteEnabled is not None:
+ oprot.writeFieldBegin('rewriteEnabled', TType.BOOL, 15)
+ oprot.writeBool(self.rewriteEnabled)
+ oprot.writeFieldEnd()
+ if self.mmNextWriteId is not None:
- oprot.writeFieldBegin('mmNextWriteId', TType.I64, 15)
++ oprot.writeFieldBegin('mmNextWriteId', TType.I64, 16)
+ oprot.writeI64(self.mmNextWriteId)
+ oprot.writeFieldEnd()
+ if self.mmWatermarkWriteId is not None:
- oprot.writeFieldBegin('mmWatermarkWriteId', TType.I64, 16)
++ oprot.writeFieldBegin('mmWatermarkWriteId', TType.I64, 17)
+ oprot.writeI64(self.mmWatermarkWriteId)
+ oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
@@@ -3385,8 -3370,7 +3397,9 @@@
value = (value * 31) ^ hash(self.tableType)
value = (value * 31) ^ hash(self.privileges)
value = (value * 31) ^ hash(self.temporary)
+ value = (value * 31) ^ hash(self.rewriteEnabled)
+ value = (value * 31) ^ hash(self.mmNextWriteId)
+ value = (value * 31) ^ hash(self.mmWatermarkWriteId)
return value
def __repr__(self):
@@@ -12747,623 -12824,13 +12891,623 @@@ class GetValidWriteIdsRequest
if ftype == TType.STOP:
break
if fid == 1:
- if ftype == TType.LIST:
- self.tables = []
- (_etype590, _size587) = iprot.readListBegin()
- for _i591 in xrange(_size587):
- _elem592 = Table()
- _elem592.read(iprot)
- self.tables.append(_elem592)
+ if ftype == TType.STRING:
+ self.dbName = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.tblName = 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('GetValidWriteIdsRequest')
+ if self.dbName is not None:
+ oprot.writeFieldBegin('dbName', TType.STRING, 1)
+ oprot.writeString(self.dbName)
+ oprot.writeFieldEnd()
+ if self.tblName is not None:
+ oprot.writeFieldBegin('tblName', TType.STRING, 2)
+ oprot.writeString(self.tblName)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.dbName is None:
+ raise TProtocol.TProtocolException(message='Required field dbName is unset!')
+ if self.tblName is None:
+ raise TProtocol.TProtocolException(message='Required field tblName is unset!')
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.dbName)
+ value = (value * 31) ^ hash(self.tblName)
+ 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 GetValidWriteIdsResult:
+ """
+ Attributes:
+ - lowWatermarkId
+ - highWatermarkId
+ - areIdsValid
+ - ids
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.I64, 'lowWatermarkId', None, None, ), # 1
+ (2, TType.I64, 'highWatermarkId', None, None, ), # 2
+ (3, TType.BOOL, 'areIdsValid', None, None, ), # 3
+ (4, TType.LIST, 'ids', (TType.I64,None), None, ), # 4
+ )
+
+ def __init__(self, lowWatermarkId=None, highWatermarkId=None, areIdsValid=None, ids=None,):
+ self.lowWatermarkId = lowWatermarkId
+ self.highWatermarkId = highWatermarkId
+ self.areIdsValid = areIdsValid
+ self.ids = ids
+
+ 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.I64:
+ self.lowWatermarkId = iprot.readI64()
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.I64:
+ self.highWatermarkId = iprot.readI64()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.BOOL:
+ self.areIdsValid = iprot.readBool()
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.LIST:
+ self.ids = []
- (_etype562, _size559) = iprot.readListBegin()
- for _i563 in xrange(_size559):
- _elem564 = iprot.readI64()
- self.ids.append(_elem564)
++ (_etype569, _size566) = iprot.readListBegin()
++ for _i570 in xrange(_size566):
++ _elem571 = iprot.readI64()
++ self.ids.append(_elem571)
+ iprot.readListEnd()
+ 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('GetValidWriteIdsResult')
+ if self.lowWatermarkId is not None:
+ oprot.writeFieldBegin('lowWatermarkId', TType.I64, 1)
+ oprot.writeI64(self.lowWatermarkId)
+ oprot.writeFieldEnd()
+ if self.highWatermarkId is not None:
+ oprot.writeFieldBegin('highWatermarkId', TType.I64, 2)
+ oprot.writeI64(self.highWatermarkId)
+ oprot.writeFieldEnd()
+ if self.areIdsValid is not None:
+ oprot.writeFieldBegin('areIdsValid', TType.BOOL, 3)
+ oprot.writeBool(self.areIdsValid)
+ oprot.writeFieldEnd()
+ if self.ids is not None:
+ oprot.writeFieldBegin('ids', TType.LIST, 4)
+ oprot.writeListBegin(TType.I64, len(self.ids))
- for iter565 in self.ids:
- oprot.writeI64(iter565)
++ for iter572 in self.ids:
++ oprot.writeI64(iter572)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.lowWatermarkId is None:
+ raise TProtocol.TProtocolException(message='Required field lowWatermarkId is unset!')
+ if self.highWatermarkId is None:
+ raise TProtocol.TProtocolException(message='Required field highWatermarkId is unset!')
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.lowWatermarkId)
+ value = (value * 31) ^ hash(self.highWatermarkId)
+ value = (value * 31) ^ hash(self.areIdsValid)
+ value = (value * 31) ^ hash(self.ids)
+ 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 GetAllFunctionsResponse:
+ """
+ Attributes:
+ - functions
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.LIST, 'functions', (TType.STRUCT,(Function, Function.thrift_spec)), None, ), # 1
+ )
+
+ def __init__(self, functions=None,):
+ self.functions = functions
+
+ 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.LIST:
+ self.functions = []
- (_etype569, _size566) = iprot.readListBegin()
- for _i570 in xrange(_size566):
- _elem571 = Function()
- _elem571.read(iprot)
- self.functions.append(_elem571)
++ (_etype576, _size573) = iprot.readListBegin()
++ for _i577 in xrange(_size573):
++ _elem578 = Function()
++ _elem578.read(iprot)
++ self.functions.append(_elem578)
+ iprot.readListEnd()
+ 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('GetAllFunctionsResponse')
+ if self.functions is not None:
+ oprot.writeFieldBegin('functions', TType.LIST, 1)
+ oprot.writeListBegin(TType.STRUCT, len(self.functions))
- for iter572 in self.functions:
- iter572.write(oprot)
++ for iter579 in self.functions:
++ iter579.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.functions)
+ 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 ClientCapabilities:
+ """
+ Attributes:
+ - values
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.LIST, 'values', (TType.I32,None), None, ), # 1
+ )
+
+ def __init__(self, values=None,):
+ self.values = values
+
+ 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.LIST:
+ self.values = []
- (_etype576, _size573) = iprot.readListBegin()
- for _i577 in xrange(_size573):
- _elem578 = iprot.readI32()
- self.values.append(_elem578)
++ (_etype583, _size580) = iprot.readListBegin()
++ for _i584 in xrange(_size580):
++ _elem585 = iprot.readI32()
++ self.values.append(_elem585)
+ iprot.readListEnd()
+ 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('ClientCapabilities')
+ if self.values is not None:
+ oprot.writeFieldBegin('values', TType.LIST, 1)
+ oprot.writeListBegin(TType.I32, len(self.values))
- for iter579 in self.values:
- oprot.writeI32(iter579)
++ for iter586 in self.values:
++ oprot.writeI32(iter586)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.values is None:
+ raise TProtocol.TProtocolException(message='Required field values is unset!')
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.values)
+ 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 GetTableRequest:
+ """
+ Attributes:
+ - dbName
+ - tblName
+ - capabilities
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'dbName', None, None, ), # 1
+ (2, TType.STRING, 'tblName', None, None, ), # 2
+ (3, TType.STRUCT, 'capabilities', (ClientCapabilities, ClientCapabilities.thrift_spec), None, ), # 3
+ )
+
+ def __init__(self, dbName=None, tblName=None, capabilities=None,):
+ self.dbName = dbName
+ self.tblName = tblName
+ self.capabilities = capabilities
+
+ 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.dbName = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.tblName = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.STRUCT:
+ self.capabilities = ClientCapabilities()
+ self.capabilities.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('GetTableRequest')
+ if self.dbName is not None:
+ oprot.writeFieldBegin('dbName', TType.STRING, 1)
+ oprot.writeString(self.dbName)
+ oprot.writeFieldEnd()
+ if self.tblName is not None:
+ oprot.writeFieldBegin('tblName', TType.STRING, 2)
+ oprot.writeString(self.tblName)
+ oprot.writeFieldEnd()
+ if self.capabilities is not None:
+ oprot.writeFieldBegin('capabilities', TType.STRUCT, 3)
+ self.capabilities.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.dbName is None:
+ raise TProtocol.TProtocolException(message='Required field dbName is unset!')
+ if self.tblName is None:
+ raise TProtocol.TProtocolException(message='Required field tblName is unset!')
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.dbName)
+ value = (value * 31) ^ hash(self.tblName)
+ value = (value * 31) ^ hash(self.capabilities)
+ 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 GetTableResult:
+ """
+ Attributes:
+ - table
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'table', (Table, Table.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, table=None,):
+ self.table = table
+
+ 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.table = Table()
+ self.table.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('GetTableResult')
+ if self.table is not None:
+ oprot.writeFieldBegin('table', TType.STRUCT, 1)
+ self.table.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.table is None:
+ raise TProtocol.TProtocolException(message='Required field table is unset!')
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.table)
+ 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 GetTablesRequest:
+ """
+ Attributes:
+ - dbName
+ - tblNames
+ - capabilities
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'dbName', None, None, ), # 1
+ (2, TType.LIST, 'tblNames', (TType.STRING,None), None, ), # 2
+ (3, TType.STRUCT, 'capabilities', (ClientCapabilities, ClientCapabilities.thrift_spec), None, ), # 3
+ )
+
+ def __init__(self, dbName=None, tblNames=None, capabilities=None,):
+ self.dbName = dbName
+ self.tblNames = tblNames
+ self.capabilities = capabilities
+
+ 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.dbName = iprot.readString()
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.LIST:
+ self.tblNames = []
- (_etype583, _size580) = iprot.readListBegin()
- for _i584 in xrange(_size580):
- _elem585 = iprot.readString()
- self.tblNames.append(_elem585)
++ (_etype590, _size587) = iprot.readListBegin()
++ for _i591 in xrange(_size587):
++ _elem592 = iprot.readString()
++ self.tblNames.append(_elem592)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.STRUCT:
+ self.capabilities = ClientCapabilities()
+ self.capabilities.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('GetTablesRequest')
+ if self.dbName is not None:
+ oprot.writeFieldBegin('dbName', TType.STRING, 1)
+ oprot.writeString(self.dbName)
+ oprot.writeFieldEnd()
+ if self.tblNames is not None:
+ oprot.writeFieldBegin('tblNames', TType.LIST, 2)
+ oprot.writeListBegin(TType.STRING, len(self.tblNames))
- for iter586 in self.tblNames:
- oprot.writeString(iter586)
++ for iter593 in self.tblNames:
++ oprot.writeString(iter593)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ if self.capabilities is not None:
+ oprot.writeFieldBegin('capabilities', TType.STRUCT, 3)
+ self.capabilities.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.dbName is None:
+ raise TProtocol.TProtocolException(message='Required field dbName is unset!')
+ return
+
+
+ def __hash__(self):
+ value = 17
+ value = (value * 31) ^ hash(self.dbName)
+ value = (value * 31) ^ hash(self.tblNames)
+ value = (value * 31) ^ hash(self.capabilities)
+ 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 GetTablesResult:
+ """
+ Attributes:
+ - tables
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.LIST, 'tables', (TType.STRUCT,(Table, Table.thrift_spec)), None, ), # 1
+ )
+
+ def __init__(self, tables=None,):
+ self.tables = tables
+
+ 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.LIST:
+ self.tables = []
- (_etype590, _size587) = iprot.readListBegin()
- for _i591 in xrange(_size587):
- _elem592 = Table()
- _elem592.read(iprot)
- self.tables.append(_elem592)
++ (_etype597, _size594) = iprot.readListBegin()
++ for _i598 in xrange(_size594):
++ _elem599 = Table()
++ _elem599.read(iprot)
++ self.tables.append(_elem599)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@@ -13380,8 -12847,8 +13524,8 @@@
if self.tables is not None:
oprot.writeFieldBegin('tables', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.tables))
-- for iter593 in self.tables:
-- iter593.write(oprot)
++ for iter600 in self.tables:
++ iter600.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
----------------------------------------------------------------------
diff --cc metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
index d6b7666,b6050c6..c671678
--- a/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
+++ b/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
@@@ -735,8 -734,7 +735,9 @@@ class Tabl
TABLETYPE = 12
PRIVILEGES = 13
TEMPORARY = 14
- MMNEXTWRITEID = 15
- MMWATERMARKWRITEID = 16
+ REWRITEENABLED = 15
++ MMNEXTWRITEID = 16
++ MMWATERMARKWRITEID = 17
FIELDS = {
TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tableName'},
@@@ -753,8 -751,7 +754,9 @@@
TABLETYPE => {:type => ::Thrift::Types::STRING, :name => 'tableType'},
PRIVILEGES => {:type => ::Thrift::Types::STRUCT, :name => 'privileges', :class => ::PrincipalPrivilegeSet, :optional => true},
TEMPORARY => {:type => ::Thrift::Types::BOOL, :name => 'temporary', :default => false, :optional => true},
- REWRITEENABLED => {:type => ::Thrift::Types::BOOL, :name => 'rewriteEnabled', :optional => true}
++ REWRITEENABLED => {:type => ::Thrift::Types::BOOL, :name => 'rewriteEnabled', :optional => true},
+ MMNEXTWRITEID => {:type => ::Thrift::Types::I64, :name => 'mmNextWriteId', :optional => true},
+ MMWATERMARKWRITEID => {:type => ::Thrift::Types::I64, :name => 'mmWatermarkWriteId', :optional => true}
}
def struct_fields; FIELDS; end
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --cc metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index 7ef810f,13d0aab..d8606b4
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@@ -18,24 -18,44 +18,45 @@@
package org.apache.hadoop.hive.metastore;
- import org.apache.hadoop.hive.metastore.api.ClientCapabilities;
- import org.apache.hadoop.hive.metastore.api.ClientCapability;
- import org.apache.hadoop.hive.metastore.api.GetTableRequest;
- import org.apache.hadoop.hive.metastore.api.GetTableResult;
- import org.apache.hadoop.hive.metastore.api.GetTablesRequest;
- import org.apache.hadoop.hive.metastore.api.GetTablesResult;
- import org.apache.hadoop.hive.metastore.api.MetaException;
+ import static org.apache.commons.lang.StringUtils.join;
+ import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_COMMENT;
+ import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_NAME;
+ import static org.apache.hadoop.hive.metastore.MetaStoreUtils.validateName;
- import com.facebook.fb303.FacebookBase;
- import com.facebook.fb303.fb_status;
- import com.google.common.annotations.VisibleForTesting;
- import com.google.common.base.Preconditions;
- import com.google.common.base.Splitter;
- import com.google.common.collect.ImmutableList;
- import com.google.common.collect.ImmutableListMultimap;
- import com.google.common.collect.Lists;
- import com.google.common.collect.Multimaps;
- import com.google.common.util.concurrent.ThreadFactoryBuilder;
+ import java.io.IOException;
+ import java.nio.ByteBuffer;
+ import java.security.PrivilegedExceptionAction;
+ import java.text.DateFormat;
+ import java.text.SimpleDateFormat;
+ import java.util.AbstractMap;
+ import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.Collections;
+ import java.util.Formatter;
+ import java.util.HashMap;
+ import java.util.HashSet;
+ import java.util.Iterator;
+ import java.util.LinkedHashMap;
+ import java.util.LinkedList;
+ import java.util.List;
+ import java.util.Map;
+ import java.util.Properties;
++import java.util.Random;
+ import java.util.Set;
+ import java.util.Timer;
+ import java.util.concurrent.Callable;
+ import java.util.concurrent.ExecutionException;
+ import java.util.concurrent.ExecutorService;
+ import java.util.concurrent.Executors;
+ import java.util.concurrent.Future;
+ import java.util.concurrent.TimeUnit;
+ import java.util.concurrent.atomic.AtomicBoolean;
+ import java.util.concurrent.locks.Condition;
+ import java.util.concurrent.locks.Lock;
+ import java.util.concurrent.locks.ReentrantLock;
+ import java.util.regex.Pattern;
+
+ import javax.jdo.JDOException;
import org.apache.commons.cli.OptionBuilder;
import org.apache.hadoop.conf.Configuration;
@@@ -127,45 -145,16 +148,21 @@@ import org.apache.thrift.transport.TTra
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
- import javax.jdo.JDOException;
- import java.io.IOException;
- import java.nio.ByteBuffer;
- import java.sql.SQLException;
- import java.security.PrivilegedExceptionAction;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.util.AbstractMap;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Collections;
- import java.util.Formatter;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.Iterator;
- import java.util.LinkedHashMap;
- import java.util.LinkedList;
- import java.util.List;
- import java.util.Map;
- import java.util.Properties;
- import java.util.Random;
- import java.util.Set;
- import java.util.Timer;
- import java.util.concurrent.Callable;
- import java.util.concurrent.ExecutionException;
- import java.util.concurrent.ExecutorService;
- import java.util.concurrent.Executors;
- import java.util.concurrent.Future;
- import java.util.concurrent.TimeUnit;
- import java.util.concurrent.atomic.AtomicBoolean;
- import java.util.concurrent.locks.Condition;
- import java.util.concurrent.locks.Lock;
- import java.util.concurrent.locks.ReentrantLock;
- import java.util.regex.Pattern;
+
+import static org.apache.commons.lang.StringUtils.join;
+import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_COMMENT;
+import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_NAME;
+import static org.apache.hadoop.hive.metastore.MetaStoreUtils.validateName;
+ import com.facebook.fb303.FacebookBase;
+ import com.facebook.fb303.fb_status;
+ import com.google.common.annotations.VisibleForTesting;
+ import com.google.common.base.Preconditions;
+ import com.google.common.base.Splitter;
+ import com.google.common.collect.ImmutableList;
+ import com.google.common.collect.ImmutableListMultimap;
+ import com.google.common.collect.Lists;
+ import com.google.common.collect.Multimaps;
+ import com.google.common.util.concurrent.ThreadFactoryBuilder;
/**
* TODO:pc remove application logic to a separate interface.
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --cc metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 013c656,b5d007d..09815db
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@@ -31,8 -59,6 +59,7 @@@ import org.apache.hadoop.hive.conf.Hive
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.hadoop.hive.conf.HiveConfUtil;
import org.apache.hadoop.hive.metastore.api.*;
+import org.apache.hadoop.hive.metastore.TableType;
- import org.apache.hadoop.hive.metastore.api.*;
import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
import org.apache.hadoop.hive.metastore.txn.TxnUtils;
import org.apache.hadoop.hive.shims.ShimLoader;
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --cc metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 8ad7059,778615d..76c9e2f
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@@ -56,10 -54,8 +56,9 @@@ import javax.jdo.PersistenceManagerFact
import javax.jdo.Query;
import javax.jdo.Transaction;
import javax.jdo.datastore.DataStoreCache;
+import javax.jdo.datastore.JDOConnection;
import javax.jdo.identity.IntIdentity;
- import com.google.common.collect.Maps;
import org.apache.commons.lang.ArrayUtils;
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
@@@ -1575,14 -1489,13 +1575,15 @@@ public class ObjectStore implements Raw
tableType = TableType.MANAGED_TABLE.toString();
}
}
- Table t = new Table(mtbl.getTableName(), mtbl.getDatabase().getName(), mtbl
- final Table table = new Table(mtbl.getTableName(), mtbl.getDatabase().getName(), mtbl
- .getOwner(), mtbl.getCreateTime(), mtbl.getLastAccessTime(), mtbl
- .getRetention(), convertToStorageDescriptor(mtbl.getSd()),
- convertToFieldSchemas(mtbl.getPartitionKeys()), convertMap(mtbl.getParameters()),
- mtbl.getViewOriginalText(), mtbl.getViewExpandedText(), tableType);
- table.setRewriteEnabled(mtbl.isRewriteEnabled());
- return table;
++ final Table t = new Table(mtbl.getTableName(), mtbl.getDatabase().getName(), mtbl
+ .getOwner(), mtbl.getCreateTime(), mtbl.getLastAccessTime(), mtbl
+ .getRetention(), convertToStorageDescriptor(mtbl.getSd()),
+ convertToFieldSchemas(mtbl.getPartitionKeys()), convertMap(mtbl.getParameters()),
+ mtbl.getViewOriginalText(), mtbl.getViewExpandedText(), tableType);
++ t.setRewriteEnabled(mtbl.isRewriteEnabled());
+ t.setMmNextWriteId(mtbl.getMmNextWriteId());
+ t.setMmWatermarkWriteId(mtbl.getMmWatermarkWriteId());
+ return t;
}
private MTable convertToMTable(Table tbl) throws InvalidObjectException,
@@@ -1619,9 -1532,8 +1620,9 @@@
convertToMStorageDescriptor(tbl.getSd()), tbl.getOwner(), tbl
.getCreateTime(), tbl.getLastAccessTime(), tbl.getRetention(),
convertToMFieldSchemas(tbl.getPartitionKeys()), tbl.getParameters(),
- tbl.getViewOriginalText(), tbl.getViewExpandedText(),
+ tbl.getViewOriginalText(), tbl.getViewExpandedText(), tbl.isRewriteEnabled(),
- tableType);
+ tableType, tbl.isSetMmNextWriteId() ? tbl.getMmNextWriteId() : 0,
+ tbl.isSetMmWatermarkWriteId() ? tbl.getMmWatermarkWriteId() : -1);
}
private List<MFieldSchema> convertToMFieldSchemas(List<FieldSchema> keys) {
@@@ -3386,8 -3299,7 +3387,9 @@@
oldt.setLastAccessTime(newt.getLastAccessTime());
oldt.setViewOriginalText(newt.getViewOriginalText());
oldt.setViewExpandedText(newt.getViewExpandedText());
+ oldt.setMmNextWriteId(newt.getMmNextWriteId());
+ oldt.setMmWatermarkWriteId(newt.getMmWatermarkWriteId());
+ oldt.setRewriteEnabled(newt.isRewriteEnabled());
// commit the changes
success = commitTransaction();
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
----------------------------------------------------------------------
diff --cc metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
index e5b469b,6593fa6..1340645
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
@@@ -2740,61 -2812,22 +2828,75 @@@ public class HBaseStore implements RawS
}
@Override
- public void addForeignKeys(List<SQLForeignKey> fks)
- throws InvalidObjectException, MetaException {
- // TODO: WTF?
+ public void addForeignKeys(List<SQLForeignKey> fks) throws InvalidObjectException, MetaException {
+ boolean commit = false;
+ openTransaction();
+ try {
+ // Fetch the existing keys (if any) and add in these new ones
+ List<SQLForeignKey> existing =
+ getHBase().getForeignKeys(fks.get(0).getFktable_db(), fks.get(0).getFktable_name());
+ if (existing == null) existing = new ArrayList<>(fks.size());
+ existing.addAll(fks);
+ getHBase().putForeignKeys(existing);
+ commit = true;
+ } catch (IOException e) {
+ LOG.error("Error writing foreign keys", e);
+ throw new MetaException("Error writing foreign keys: " + e.getMessage());
+ } finally {
+ commitOrRoleBack(commit);
+ }
}
+
+ @Override
+ public void createTableWrite(Table tbl, long writeId, char state, long heartbeat) {
+ // TODO: Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void updateTableWrite(MTableWrite tw) {
+ // TODO: Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public MTableWrite getTableWrite(String dbName, String tblName, long writeId) {
+ // TODO: Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+
+ @Override
+ public List<Long> getTableWriteIds(
+ String dbName, String tblName, long watermarkId, long nextWriteId, char state) {
+ // TODO: Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List<FullTableName> getAllMmTablesForCleanup() throws MetaException {
+ // TODO: Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List<MTableWrite> getTableWrites(String dbName, String tblName,
+ long from, long to) throws MetaException {
+ // TODO: Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<String> getAllPartitionLocations(String dbName,
+ String tblName) {
+ // TODO: Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void deleteTableWrites(String dbName, String tblName, long from,
+ long to) throws MetaException {
+ // TODO: Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
}
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/model/org/apache/hadoop/hive/metastore/model/MTable.java
----------------------------------------------------------------------
diff --cc metastore/src/model/org/apache/hadoop/hive/metastore/model/MTable.java
index 51c62e3,6cc7157..18e9cb3
--- a/metastore/src/model/org/apache/hadoop/hive/metastore/model/MTable.java
+++ b/metastore/src/model/org/apache/hadoop/hive/metastore/model/MTable.java
@@@ -34,9 -34,8 +34,10 @@@ public class MTable
private Map<String, String> parameters;
private String viewOriginalText;
private String viewExpandedText;
+ private boolean rewriteEnabled;
private String tableType;
+ private long mmNextWriteId;
+ private long mmWatermarkWriteId;
public MTable() {}
@@@ -56,9 -55,8 +57,9 @@@
*/
public MTable(String tableName, MDatabase database, MStorageDescriptor sd, String owner,
int createTime, int lastAccessTime, int retention, List<MFieldSchema> partitionKeys,
- Map<String, String> parameters, String viewOriginalText, String viewExpandedText,
- boolean rewriteEnabled, String tableType) {
+ Map<String, String> parameters,
- String viewOriginalText, String viewExpandedText, String tableType, long mmNextWriteId,
++ String viewOriginalText, String viewExpandedText, boolean rewriteEnabled, String tableType, long mmNextWriteId,
+ long mmWatermarkWriteId) {
this.tableName = tableName;
this.database = database;
this.sd = sd;
@@@ -70,9 -68,8 +71,10 @@@
this.parameters = parameters;
this.viewOriginalText = viewOriginalText;
this.viewExpandedText = viewExpandedText;
+ this.rewriteEnabled = rewriteEnabled;
this.tableType = tableType;
+ this.mmWatermarkWriteId = mmWatermarkWriteId;
+ this.mmNextWriteId = mmNextWriteId;
}
/**
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/model/package.jdo
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java
----------------------------------------------------------------------
diff --cc metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java
index aa9fa61,1f87eeb..aaa03fb
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java
+++ b/metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java
@@@ -17,13 -17,12 +17,15 @@@
*/
package org.apache.hadoop.hive.metastore;
+import static org.junit.Assert.*;
+
import java.util.Arrays;
import java.util.HashMap;
+ import java.util.HashSet;
import java.util.List;
+ import java.util.Set;
+import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.common.metrics.common.MetricsConstant;
import org.apache.hadoop.hive.common.metrics.common.MetricsFactory;
import org.apache.hadoop.hive.common.metrics.metrics2.CodahaleMetrics;
@@@ -161,10 -146,10 +165,10 @@@ public class TestObjectStore
public void testTableOps() throws MetaException, InvalidObjectException, NoSuchObjectException, InvalidInputException {
Database db1 = new Database(DB1, "description", "locationurl", null);
objectStore.createDatabase(db1);
- StorageDescriptor sd = new StorageDescriptor(null, "location", null, null, false, 0, new SerDeInfo("SerDeName", "serializationLib", null), null, null, null);
+ StorageDescriptor sd = createFakeSd("location");
HashMap<String,String> params = new HashMap<String,String>();
params.put("EXTERNAL", "false");
- Table tbl1 = new Table(TABLE1, DB1, "owner", 1, 2, 3, sd, null, params, "viewOriginalText", "viewExpandedText", "MANAGED_TABLE");
+ Table tbl1 = new Table(TABLE1, DB1, "owner", 1, 2, 3, sd, null, params, null, null, "MANAGED_TABLE");
objectStore.createTable(tbl1);
List<String> tables = objectStore.getAllTables(DB1);
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/Context.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
----------------------------------------------------------------------
diff --cc ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
index be65f49,ad701f6..85bc04b
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
@@@ -164,11 -165,10 +167,12 @@@ import org.apache.hadoop.hive.ql.plan.D
import org.apache.hadoop.hive.ql.plan.FileMergeDesc;
import org.apache.hadoop.hive.ql.plan.GrantDesc;
import org.apache.hadoop.hive.ql.plan.GrantRevokeRoleDDL;
+ import org.apache.hadoop.hive.ql.plan.InsertTableDesc;
import org.apache.hadoop.hive.ql.plan.ListBucketingCtx;
+import org.apache.hadoop.hive.ql.plan.LoadMultiFilesDesc;
import org.apache.hadoop.hive.ql.plan.LockDatabaseDesc;
import org.apache.hadoop.hive.ql.plan.LockTableDesc;
+import org.apache.hadoop.hive.ql.plan.MoveWork;
import org.apache.hadoop.hive.ql.plan.MsckDesc;
import org.apache.hadoop.hive.ql.plan.OperatorDesc;
import org.apache.hadoop.hive.ql.plan.OrcFileMergeDesc;
@@@ -3452,8 -3510,18 +3525,18 @@@ public class DDLTask extends Task<DDLWo
return false;
}
- private int alterTableOrSinglePartition(AlterTableDesc alterTbl, Table tbl, Partition part)
- throws HiveException {
+ private List<Task<?>> alterTableOrSinglePartition(
+ AlterTableDesc alterTbl, Table tbl, Partition part) throws HiveException {
+ EnvironmentContext environmentContext = alterTbl.getEnvironmentContext();
+ if (environmentContext == null) {
+ environmentContext = new EnvironmentContext();
+ alterTbl.setEnvironmentContext(environmentContext);
+ }
+ // do not need update stats in alter table/partition operations
+ if (environmentContext.getProperties() == null ||
+ environmentContext.getProperties().get(StatsSetupConst.DO_NOT_UPDATE_STATS) == null) {
+ environmentContext.putToProperties(StatsSetupConst.DO_NOT_UPDATE_STATS, StatsSetupConst.TRUE);
+ }
if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.RENAME) {
tbl.setDbName(Utilities.getDatabaseName(alterTbl.getNewName()));
@@@ -3591,9 -3659,29 +3674,9 @@@
}
sd.setCols(alterTbl.getNewCols());
} else if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.ADDPROPS) {
- return alterTableAddProps(alterTbl, tbl, part);
- if (StatsSetupConst.USER.equals(environmentContext.getProperties()
- .get(StatsSetupConst.STATS_GENERATED))) {
- environmentContext.getProperties().remove(StatsSetupConst.DO_NOT_UPDATE_STATS);
- }
- if (part != null) {
- part.getTPartition().getParameters().putAll(alterTbl.getProps());
- } else {
- tbl.getTTable().getParameters().putAll(alterTbl.getProps());
- }
++ return alterTableAddProps(alterTbl, tbl, part, environmentContext);
} else if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.DROPPROPS) {
- return alterTableDropProps(alterTbl, tbl, part);
- Iterator<String> keyItr = alterTbl.getProps().keySet().iterator();
- if (StatsSetupConst.USER.equals(environmentContext.getProperties()
- .get(StatsSetupConst.STATS_GENERATED))) {
- // drop a stats parameter, which triggers recompute stats update automatically
- environmentContext.getProperties().remove(StatsSetupConst.DO_NOT_UPDATE_STATS);
- }
- while (keyItr.hasNext()) {
- if (part != null) {
- part.getTPartition().getParameters().remove(keyItr.next());
- } else {
- tbl.getTTable().getParameters().remove(keyItr.next());
- }
- }
++ return alterTableDropProps(alterTbl, tbl, part, environmentContext);
} else if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.ADDSERDEPROPS) {
StorageDescriptor sd = (part == null ? tbl.getTTable().getSd() : part.getTPartition().getSd());
sd.getSerdeInfo().getParameters().putAll(alterTbl.getProps());
@@@ -3741,184 -3833,7 +3828,194 @@@
throw new HiveException(ErrorMsg.UNSUPPORTED_ALTER_TBL_OP, alterTbl.getOp().toString());
}
- return 0;
+ return null;
+ }
+
- private List<Task<?>> alterTableDropProps(
- AlterTableDesc alterTbl, Table tbl, Partition part) throws HiveException {
++ private List<Task<?>> alterTableDropProps(AlterTableDesc alterTbl, Table tbl,
++ Partition part, EnvironmentContext environmentContext) throws HiveException {
++ if (StatsSetupConst.USER.equals(environmentContext.getProperties()
++ .get(StatsSetupConst.STATS_GENERATED))) {
++ // drop a stats parameter, which triggers recompute stats update automatically
++ environmentContext.getProperties().remove(StatsSetupConst.DO_NOT_UPDATE_STATS);
++ }
++
+ List<Task<?>> result = null;
+ if (part == null) {
+ Set<String> removedSet = alterTbl.getProps().keySet();
+ boolean isFromMmTable = MetaStoreUtils.isInsertOnlyTable(tbl.getParameters()),
+ isRemoved = MetaStoreUtils.isRemovedInsertOnlyTable(removedSet);
+ if (isFromMmTable && isRemoved) {
+ result = generateRemoveMmTasks(tbl);
+ }
+ }
+ Iterator<String> keyItr = alterTbl.getProps().keySet().iterator();
+ while (keyItr.hasNext()) {
+ if (part != null) {
+ part.getTPartition().getParameters().remove(keyItr.next());
+ } else {
+ tbl.getTTable().getParameters().remove(keyItr.next());
+ }
+ }
+ return result;
+ }
+
+ private List<Task<?>> generateRemoveMmTasks(Table tbl) throws HiveException {
+ // To avoid confusion from nested MM directories when table is converted back and forth,
+ // we will do the following - we will rename mm_ dirs to remove the prefix; we will also
+ // delete any directories that are not committed. Note that this relies on locks.
+ // Note also that we only do the renames AFTER the metastore operation commits.
+ // Deleting uncommitted things is safe, but moving stuff before we convert is data loss.
+ List<Path> allMmDirs = new ArrayList<>();
+ if (tbl.isStoredAsSubDirectories()) {
+ // TODO: support this?
+ throw new HiveException("Converting list bucketed tables stored as subdirectories "
+ + " to and from MM is not supported");
+ }
+ Hive db = getHive();
+ ValidWriteIds ids = db.getValidWriteIdsForTable(tbl.getDbName(), tbl.getTableName());
+ if (tbl.getPartitionKeys().size() > 0) {
+ PartitionIterable parts = new PartitionIterable(db, tbl, null,
+ HiveConf.getIntVar(conf, ConfVars.METASTORE_BATCH_RETRIEVE_MAX));
+ Iterator<Partition> partIter = parts.iterator();
+ while (partIter.hasNext()) {
+ Partition part = partIter.next();
+ checkMmLb(part);
+ handleRemoveMm(part.getDataLocation(), ids, allMmDirs);
+ }
+ } else {
+ checkMmLb(tbl);
+ handleRemoveMm(tbl.getDataLocation(), ids, allMmDirs);
+ }
+ List<Path> targetPaths = new ArrayList<>(allMmDirs.size());
+ int prefixLen = ValidWriteIds.MM_PREFIX.length();
+ for (int i = 0; i < allMmDirs.size(); ++i) {
+ Path src = allMmDirs.get(i);
+ Path tgt = new Path(src.getParent(), src.getName().substring(prefixLen + 1));
+ Utilities.LOG14535.info("Will move " + src + " to " + tgt);
+ targetPaths.add(tgt);
+ }
+ // Don't set inputs and outputs - the locks have already been taken so it's pointless.
+ MoveWork mw = new MoveWork(null, null, null, null, false);
+ mw.setMultiFilesDesc(new LoadMultiFilesDesc(allMmDirs, targetPaths, true, null, null));
+ return Lists.<Task<?>>newArrayList(TaskFactory.get(mw, conf));
+ }
+
+ private void checkMmLb(Table tbl) throws HiveException {
+ if (!tbl.isStoredAsSubDirectories()) return;
+ // TODO: support this?
+ throw new HiveException("Converting list bucketed tables stored as subdirectories "
+ + " to and from MM is not supported");
+ }
+
+ private void checkMmLb(Partition part) throws HiveException {
+ if (!part.isStoredAsSubDirectories()) return;
+ // TODO: support this?
+ throw new HiveException("Converting list bucketed tables stored as subdirectories "
+ + " to and from MM is not supported. Please create a table in the desired format.");
+ }
+
+ private void handleRemoveMm(
+ Path path, ValidWriteIds ids, List<Path> result) throws HiveException {
+ // Note: doesn't take LB into account; that is not presently supported here (throws above).
+ try {
+ FileSystem fs = path.getFileSystem(conf);
+ for (FileStatus file : fs.listStatus(path)) {
+ Path childPath = file.getPath();
+ if (!file.isDirectory()) {
+ ensureDelete(fs, childPath, "a non-directory file");
+ continue;
+ }
+ Long writeId = ValidWriteIds.extractWriteId(childPath);
+ if (writeId == null) {
+ ensureDelete(fs, childPath, "an unknown directory");
+ } else if (!ids.isValid(writeId)) {
+ // Assume no concurrent active writes - we rely on locks here. We could check and fail.
+ ensureDelete(fs, childPath, "an uncommitted directory");
+ } else {
+ result.add(childPath);
+ }
+ }
+ } catch (IOException ex) {
+ throw new HiveException(ex);
+ }
+ }
+
+ private static void ensureDelete(FileSystem fs, Path path, String what) throws IOException {
+ Utilities.LOG14535.info("Deleting " + what + " " + path);
+ try {
+ if (!fs.delete(path, true)) throw new IOException("delete returned false");
+ } catch (Exception ex) {
+ String error = "Couldn't delete " + path + "; cannot remove MM setting from the table";
+ LOG.error(error, ex);
+ throw (ex instanceof IOException) ? (IOException)ex : new IOException(ex);
+ }
+ }
+
+ private List<Task<?>> generateAddMmTasks(Table tbl) throws HiveException {
+ // We will move all the files in the table/partition directories into the first MM
+ // directory, then commit the first write ID.
+ List<Path> srcs = new ArrayList<>(), tgts = new ArrayList<>();
+ Hive db = getHive();
+ long mmWriteId = db.getNextTableWriteId(tbl.getDbName(), tbl.getTableName());
+ String mmDir = ValidWriteIds.getMmFilePrefix(mmWriteId);
+ if (tbl.getPartitionKeys().size() > 0) {
+ PartitionIterable parts = new PartitionIterable(db, tbl, null,
+ HiveConf.getIntVar(conf, ConfVars.METASTORE_BATCH_RETRIEVE_MAX));
+ Iterator<Partition> partIter = parts.iterator();
+ while (partIter.hasNext()) {
+ Partition part = partIter.next();
+ checkMmLb(part);
+ Path src = part.getDataLocation(), tgt = new Path(src, mmDir);
+ srcs.add(src);
+ tgts.add(tgt);
+ Utilities.LOG14535.info("Will move " + src + " to " + tgt);
+ }
+ } else {
+ checkMmLb(tbl);
+ Path src = tbl.getDataLocation(), tgt = new Path(src, mmDir);
+ srcs.add(src);
+ tgts.add(tgt);
+ Utilities.LOG14535.info("Will move " + src + " to " + tgt);
+ }
+ // Don't set inputs and outputs - the locks have already been taken so it's pointless.
+ MoveWork mw = new MoveWork(null, null, null, null, false);
+ mw.setMultiFilesDesc(new LoadMultiFilesDesc(srcs, tgts, true, null, null));
+ ImportCommitWork icw = new ImportCommitWork(tbl.getDbName(), tbl.getTableName(), mmWriteId);
+ // TODO# this is hacky and will be gone with ACID. The problem is getting the write ID above
+ // modifies the table, but the table object above is preserved and modified without
+ // getting this change, so saving it will overwrite write ID. Ideally, when we save
+ // only specific fields, and not overwrite write ID every time we alter table.
+ // There's probably some way in DN to achieve that, but for now let's just update the
+ // original object here. This is safe due to DDL lock and the fact that converting
+ // the table to MM here from non-MM should mean no concurrent write ID updates.
+ tbl.setMmNextWriteId(mmWriteId + 1);
+ Task<?> mv = TaskFactory.get(mw, conf), ic = TaskFactory.get(icw, conf);
+ mv.addDependentTask(ic);
+ return Lists.<Task<?>>newArrayList(mv);
+ }
+
+ private List<Task<?>> alterTableAddProps(AlterTableDesc alterTbl, Table tbl,
- Partition part) throws HiveException {
++ Partition part, EnvironmentContext environmentContext) throws HiveException {
++ if (StatsSetupConst.USER.equals(environmentContext.getProperties()
++ .get(StatsSetupConst.STATS_GENERATED))) {
++ environmentContext.getProperties().remove(StatsSetupConst.DO_NOT_UPDATE_STATS);
++ }
+ List<Task<?>> result = null;
+ if (part != null) {
+ part.getTPartition().getParameters().putAll(alterTbl.getProps());
+ } else {
+ boolean isFromMmTable = MetaStoreUtils.isInsertOnlyTable(tbl.getParameters());
+ Boolean isToMmTable = MetaStoreUtils.isToInsertOnlyTable(alterTbl.getProps());
+ if (isToMmTable != null) {
+ if (!isFromMmTable && isToMmTable) {
+ result = generateAddMmTasks(tbl);
+ } else if (isFromMmTable && !isToMmTable) {
+ result = generateRemoveMmTasks(tbl);
+ }
+ }
+ tbl.getTTable().getParameters().putAll(alterTbl.getProps());
+ }
+ return result;
}
private int dropConstraint(Hive db, AlterTableDesc alterTbl)
@@@ -4257,8 -4173,24 +4355,24 @@@
LOG.info("creating table " + tbl.getDbName() + "." + tbl.getTableName() + " on " +
tbl.getDataLocation());
+ if (crtTbl.getReplicationSpec().isInReplicationScope() && (!crtTbl.getReplaceMode())){
+ // if this is a replication spec, then replace-mode semantics might apply.
+ // if we're already asking for a table replacement, then we can skip this check.
+ // however, otherwise, if in replication scope, and we've not been explicitly asked
+ // to replace, we should check if the object we're looking at exists, and if so,
+ // trigger replace-mode semantics.
+ Table existingTable = db.getTable(tbl.getDbName(), tbl.getTableName(), false);
+ if (existingTable != null){
+ if (!crtTbl.getReplicationSpec().allowEventReplacementInto(existingTable)){
+ return 0; // no replacement, the existing table state is newer than our update.
+ } else {
+ crtTbl.setReplaceMode(true); // we replace existing table.
+ }
+ }
+ }
+
// create the table
- if (crtTbl.getReplaceMode()){
+ if (crtTbl.getReplaceMode()) {
// replace-mode creates are really alters using CreateTableDesc.
try {
db.alterTable(tbl.getDbName()+"."+tbl.getTableName(),tbl,null);
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
----------------------------------------------------------------------
diff --cc ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
index 8e9e605,3bbe92d..530b364
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
@@@ -18,23 -18,8 +18,23 @@@
package org.apache.hadoop.hive.ql.exec;
+import static org.apache.hadoop.hive.conf.HiveConf.ConfVars.HIVE_TEMPORARY_TABLE_STORAGE;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
-
+ import com.google.common.collect.Lists;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@@ -459,9 -356,8 +472,9 @@@ public class FileSinkOperator extends T
parent = Utilities.toTempPath(conf.getDirName());
statsFromRecordWriter = new boolean[numFiles];
serializer = (Serializer) conf.getTableInfo().getDeserializerClass().newInstance();
- serializer.initialize(hconf, conf.getTableInfo().getProperties());
+ serializer.initialize(unsetNestedColumnPaths(hconf), conf.getTableInfo().getProperties());
outputClass = serializer.getSerializedClass();
+ inheritPerms = HiveConf.getBoolVar(hconf, ConfVars.HIVE_WAREHOUSE_SUBDIR_INHERIT_PERMS);
if (isLogInfoEnabled) {
LOG.info("Using serializer : " + serializer + " and formatter : " + hiveOutputFormat +
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableSinkOperator.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/JoinOperator.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java
----------------------------------------------------------------------
diff --cc ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java
index 01915f9,1802f37..b3e6f4e
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java
@@@ -393,231 -550,6 +389,232 @@@ public class MoveTask extends Task<Move
return (1);
}
}
+
+ private DataContainer handleStaticParts(Hive db, Table table, LoadTableDesc tbd,
+ TaskInformation ti) throws HiveException, IOException, InvalidOperationException {
+ List<String> partVals = MetaStoreUtils.getPvals(table.getPartCols(), tbd.getPartitionSpec());
+ db.validatePartitionNameCharacters(partVals);
+ Utilities.LOG14535.info("loadPartition called from " + tbd.getSourcePath()
+ + " into " + tbd.getTable().getTableName());
+ boolean isCommitMmWrite = tbd.isCommitMmWrite();
+ db.loadSinglePartition(tbd.getSourcePath(), tbd.getTable().getTableName(),
+ tbd.getPartitionSpec(), tbd.getReplace(),
+ tbd.getInheritTableSpecs(), isSkewedStoredAsDirs(tbd), work.isSrcLocal(),
+ (work.getLoadTableWork().getWriteType() != AcidUtils.Operation.NOT_ACID &&
+ work.getLoadTableWork().getWriteType() != AcidUtils.Operation.INSERT_ONLY),
+ hasFollowingStatsTask(), tbd.getMmWriteId(), isCommitMmWrite);
+ Partition partn = db.getPartition(table, tbd.getPartitionSpec(), false);
+
+ if (ti.bucketCols != null || ti.sortCols != null) {
+ updatePartitionBucketSortColumns(db, table, partn, ti.bucketCols,
+ ti.numBuckets, ti.sortCols);
+ }
+
+ DataContainer dc = new DataContainer(table.getTTable(), partn.getTPartition());
+ // add this partition to post-execution hook
+ if (work.getOutputs() != null) {
+ DDLTask.addIfAbsentByName(new WriteEntity(partn,
+ getWriteType(tbd, work.getLoadTableWork().getWriteType())), work.getOutputs());
+ }
+ return dc;
+ }
+
+ private DataContainer handleDynParts(Hive db, Table table, LoadTableDesc tbd,
+ TaskInformation ti, DynamicPartitionCtx dpCtx) throws HiveException,
+ IOException, InvalidOperationException {
+ DataContainer dc;
+ List<LinkedHashMap<String, String>> dps = Utilities.getFullDPSpecs(conf, dpCtx);
+
- // publish DP columns to its subscribers
- if (dps != null && dps.size() > 0) {
- pushFeed(FeedType.DYNAMIC_PARTITIONS, dps);
- }
+ console.printInfo(System.getProperty("line.separator"));
+ long startTime = System.currentTimeMillis();
+ // load the list of DP partitions and return the list of partition specs
+ // TODO: In a follow-up to HIVE-1361, we should refactor loadDynamicPartitions
+ // to use Utilities.getFullDPSpecs() to get the list of full partSpecs.
+ // After that check the number of DPs created to not exceed the limit and
+ // iterate over it and call loadPartition() here.
+ // The reason we don't do inside HIVE-1361 is the latter is large and we
+ // want to isolate any potential issue it may introduce.
+ if (tbd.isMmTable() && !tbd.isCommitMmWrite()) {
+ throw new HiveException("Only single-partition LoadTableDesc can skip commiting write ID");
+ }
+ Map<Map<String, String>, Partition> dp =
+ db.loadDynamicPartitions(
+ tbd.getSourcePath(),
+ tbd.getTable().getTableName(),
+ tbd.getPartitionSpec(),
+ tbd.getReplace(),
+ dpCtx.getNumDPCols(),
+ (tbd.getLbCtx() == null) ? 0 : tbd.getLbCtx().calculateListBucketingLevel(),
+ work.getLoadTableWork().getWriteType() != AcidUtils.Operation.NOT_ACID &&
+ work.getLoadTableWork().getWriteType() != AcidUtils.Operation.INSERT_ONLY,
+ SessionState.get().getTxnMgr().getCurrentTxnId(), hasFollowingStatsTask(),
+ work.getLoadTableWork().getWriteType(),
+ tbd.getMmWriteId());
+
++ // publish DP columns to its subscribers
++ if (dps != null && dps.size() > 0) {
++ pushFeed(FeedType.DYNAMIC_PARTITIONS, dps);
++ }
++
+ String loadTime = "\t Time taken to load dynamic partitions: " +
+ (System.currentTimeMillis() - startTime)/1000.0 + " seconds";
+ console.printInfo(loadTime);
+ LOG.info(loadTime);
+
+ if (dp.size() == 0 && conf.getBoolVar(HiveConf.ConfVars.HIVE_ERROR_ON_EMPTY_PARTITION)) {
+ throw new HiveException("This query creates no partitions." +
+ " To turn off this error, set hive.error.on.empty.partition=false.");
+ }
+
+ startTime = System.currentTimeMillis();
+ // for each partition spec, get the partition
+ // and put it to WriteEntity for post-exec hook
+ for(Map.Entry<Map<String, String>, Partition> entry : dp.entrySet()) {
+ Partition partn = entry.getValue();
+
+ if (ti.bucketCols != null || ti.sortCols != null) {
+ updatePartitionBucketSortColumns(
+ db, table, partn, ti.bucketCols, ti.numBuckets, ti.sortCols);
+ }
+
+ WriteEntity enty = new WriteEntity(partn,
+ getWriteType(tbd, work.getLoadTableWork().getWriteType()));
+ if (work.getOutputs() != null) {
+ DDLTask.addIfAbsentByName(enty, work.getOutputs());
+ }
+ // Need to update the queryPlan's output as well so that post-exec hook get executed.
+ // This is only needed for dynamic partitioning since for SP the the WriteEntity is
+ // constructed at compile time and the queryPlan already contains that.
+ // For DP, WriteEntity creation is deferred at this stage so we need to update
+ // queryPlan here.
+ if (queryPlan.getOutputs() == null) {
+ queryPlan.setOutputs(new LinkedHashSet<WriteEntity>());
+ }
+ queryPlan.getOutputs().add(enty);
+
+ // update columnar lineage for each partition
+ dc = new DataContainer(table.getTTable(), partn.getTPartition());
+
+ // Don't set lineage on delete as we don't have all the columns
+ if (SessionState.get() != null &&
+ work.getLoadTableWork().getWriteType() != AcidUtils.Operation.DELETE &&
+ work.getLoadTableWork().getWriteType() != AcidUtils.Operation.UPDATE) {
+ SessionState.get().getLineageState().setLineage(tbd.getSourcePath(), dc,
+ table.getCols());
+ }
+ LOG.info("\tLoading partition " + entry.getKey());
+ }
+ console.printInfo("\t Time taken for adding to write entity : " +
+ (System.currentTimeMillis() - startTime)/1000.0 + " seconds");
+ dc = null; // reset data container to prevent it being added again.
+ return dc;
+ }
+
+ private void inferTaskInformation(TaskInformation ti) {
+ // Find the first ancestor of this MoveTask which is some form of map reduce task
+ // (Either standard, local, or a merge)
+ while (ti.task.getParentTasks() != null && ti.task.getParentTasks().size() == 1) {
+ ti.task = (Task)ti.task.getParentTasks().get(0);
+ // If it was a merge task or a local map reduce task, nothing can be inferred
+ if (ti.task instanceof MergeFileTask || ti.task instanceof MapredLocalTask) {
+ break;
+ }
+
+ // If it's a standard map reduce task, check what, if anything, it inferred about
+ // the directory this move task is moving
+ if (ti.task instanceof MapRedTask) {
+ MapredWork work = (MapredWork)ti.task.getWork();
+ MapWork mapWork = work.getMapWork();
+ ti.bucketCols = mapWork.getBucketedColsByDirectory().get(ti.path);
+ ti.sortCols = mapWork.getSortedColsByDirectory().get(ti.path);
+ if (work.getReduceWork() != null) {
+ ti.numBuckets = work.getReduceWork().getNumReduceTasks();
+ }
+
+ if (ti.bucketCols != null || ti.sortCols != null) {
+ // This must be a final map reduce task (the task containing the file sink
+ // operator that writes the final output)
+ assert work.isFinalMapRed();
+ }
+ break;
+ }
+
+ // If it's a move task, get the path the files were moved from, this is what any
+ // preceding map reduce task inferred information about, and moving does not invalidate
+ // those assumptions
+ // This can happen when a conditional merge is added before the final MoveTask, but the
+ // condition for merging is not met, see GenMRFileSink1.
+ if (ti.task instanceof MoveTask) {
+ MoveTask mt = (MoveTask)ti.task;
+ if (mt.getWork().getLoadFileWork() != null) {
+ ti.path = mt.getWork().getLoadFileWork().getSourcePath().toUri().toString();
+ }
+ }
+ }
+ }
+
+ private void checkFileFormats(Hive db, LoadTableDesc tbd, Table table)
+ throws HiveException {
+ if (work.getCheckFileFormat()) {
+ // Get all files from the src directory
+ FileStatus[] dirs;
+ ArrayList<FileStatus> files;
+ FileSystem srcFs; // source filesystem
+ try {
+ srcFs = tbd.getSourcePath().getFileSystem(conf);
+ dirs = srcFs.globStatus(tbd.getSourcePath());
+ files = new ArrayList<FileStatus>();
+ for (int i = 0; (dirs != null && i < dirs.length); i++) {
+ files.addAll(Arrays.asList(srcFs.listStatus(dirs[i].getPath(), FileUtils.HIDDEN_FILES_PATH_FILTER)));
+ // We only check one file, so exit the loop when we have at least
+ // one.
+ if (files.size() > 0) {
+ break;
+ }
+ }
+ } catch (IOException e) {
+ throw new HiveException(
+ "addFiles: filesystem error in check phase", e);
+ }
+
+ // handle file format check for table level
+ if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVECHECKFILEFORMAT)) {
+ boolean flag = true;
+ // work.checkFileFormat is set to true only for Load Task, so assumption here is
+ // dynamic partition context is null
+ if (tbd.getDPCtx() == null) {
+ if (tbd.getPartitionSpec() == null || tbd.getPartitionSpec().isEmpty()) {
+ // Check if the file format of the file matches that of the table.
+ flag = HiveFileFormatUtils.checkInputFormat(
+ srcFs, conf, tbd.getTable().getInputFileFormatClass(), files);
+ } else {
+ // Check if the file format of the file matches that of the partition
+ Partition oldPart = db.getPartition(table, tbd.getPartitionSpec(), false);
+ if (oldPart == null) {
+ // this means we have just created a table and are specifying partition in the
+ // load statement (without pre-creating the partition), in which case lets use
+ // table input format class. inheritTableSpecs defaults to true so when a new
+ // partition is created later it will automatically inherit input format
+ // from table object
+ flag = HiveFileFormatUtils.checkInputFormat(
+ srcFs, conf, tbd.getTable().getInputFileFormatClass(), files);
+ } else {
+ flag = HiveFileFormatUtils.checkInputFormat(
+ srcFs, conf, oldPart.getInputFormatClass(), files);
+ }
+ }
+ if (!flag) {
+ throw new HiveException(
+ "Wrong file format. Please check the file's format.");
+ }
+ } else {
+ LOG.warn("Skipping file format check as dpCtx is not null");
+ }
+ }
+ }
+ }
+
+
/**
* so to make sure we crate WriteEntity with the right WriteType. This is (at this point) only
* for consistency since LockManager (which is the only thing that pays attention to WriteType)
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/ReplCopyTask.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/StatsTask.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
----------------------------------------------------------------------
diff --cc ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
index a93c7e1,12a03d0..80ca28d
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
@@@ -18,61 -18,12 +18,64 @@@
package org.apache.hadoop.hive.ql.exec;
+ import com.esotericsoftware.kryo.Kryo;
+ import com.google.common.annotations.VisibleForTesting;
+ import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.Statement;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.URLDecoder;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLTransientException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.InflaterInputStream;
-
+ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;
@@@ -204,10 -147,59 +207,63 @@@ import org.apache.hive.common.util.Refl
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.esotericsoftware.kryo.Kryo;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+ import java.beans.DefaultPersistenceDelegate;
+ import java.beans.Encoder;
+ import java.beans.Expression;
+ import java.beans.Statement;
+ import java.io.ByteArrayInputStream;
+ import java.io.ByteArrayOutputStream;
+ import java.io.DataInput;
+ import java.io.EOFException;
+ import java.io.File;
+ import java.io.FileNotFoundException;
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.OutputStream;
+ import java.io.Serializable;
+ import java.net.URI;
+ import java.net.URL;
+ import java.net.URLClassLoader;
+ import java.net.URLDecoder;
+ import java.sql.Connection;
+ import java.sql.DriverManager;
+ import java.sql.PreparedStatement;
+ import java.sql.SQLException;
+ import java.sql.SQLFeatureNotSupportedException;
+ import java.sql.SQLTransientException;
+ import java.text.SimpleDateFormat;
+ import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.Calendar;
+ import java.util.Collection;
+ import java.util.Enumeration;
+ import java.util.HashMap;
+ import java.util.HashSet;
+ import java.util.Iterator;
+ import java.util.LinkedHashMap;
+ import java.util.LinkedList;
+ import java.util.List;
+ import java.util.Map;
+ import java.util.Properties;
+ import java.util.Random;
+ import java.util.Set;
+ import java.util.UUID;
+ import java.util.concurrent.Callable;
+ import java.util.concurrent.ConcurrentHashMap;
+ import java.util.concurrent.ExecutionException;
+ import java.util.concurrent.ExecutorService;
+ import java.util.concurrent.Executors;
+ import java.util.concurrent.Future;
+ import java.util.regex.Matcher;
+ import java.util.regex.Pattern;
+ import java.util.zip.Deflater;
+ import java.util.zip.DeflaterOutputStream;
+ import java.util.zip.InflaterInputStream;
+
+
/**
* Utilities.
*
@@@ -3064,18 -3013,18 +3161,25 @@@ public final class Utilities
LOG.info("Processing alias " + alias);
// The alias may not have any path
+ Collection<Map.Entry<Path, ArrayList<String>>> pathToAliases =
+ work.getPathToAliases().entrySet();
+ if (!skipDummy) {
+ // ConcurrentModification otherwise if adding dummy.
+ pathToAliases = new ArrayList<>(pathToAliases);
+ }
+ boolean isEmptyTable = true;
+ boolean hasLogged = false;
- // Note: this copies the list because createDummyFileForEmptyPartition may modify the map.
- for (Path file : new LinkedList<Path>(work.getPathToAliases().keySet())) {
- List<String> aliases = work.getPathToAliases().get(file);
+ Path path = null;
+ for (Map.Entry<Path, ArrayList<String>> e : pathToAliases) {
+ Path file = e.getKey();
+ List<String> aliases = e.getValue();
if (aliases.contains(alias)) {
- path = file;
+ if (file != null) {
+ isEmptyTable = false;
+ } else {
+ LOG.warn("Found a null path for alias " + alias);
+ continue;
+ }
// Multiple aliases can point to the same path - it should be
// processed only once
@@@ -3083,13 -3032,16 +3187,16 @@@
continue;
}
- pathsProcessed.add(file);
-
+ pathsProcessed.add(path);
-
- LOG.info("Adding input file " + path);
- if (!skipDummy && isEmptyPath(job, path, ctx)) {
- path = createDummyFileForEmptyPartition(path, job, work, hiveScratchDir);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Adding input file " + file);
+ } else if (!hasLogged) {
+ hasLogged = true;
+ LOG.info("Adding " + work.getPathToAliases().size()
+ + " inputs; the first input is " + file);
}
- pathsToAdd.add(path);
++
+ pathsToAdd.add(file);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
----------------------------------------------------------------------
diff --cc ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
index d6a212fd,51530ac..5ea3cec
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
@@@ -24,11 -23,11 +24,13 @@@ import java.io.FileNotFoundException
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashMap;
+ import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Map.Entry;
@@@ -218,9 -221,29 +227,29 @@@ public class HiveInputFormat<K extends
isVectorized = HiveConf.getBoolVar(conf, ConfVars.LLAP_IO_NONVECTOR_WRAPPER_ENABLED)
&& (Utilities.getPlanPath(conf) != null);
}
+ boolean isSerdeBased = false;
+ if (isVectorized && !isSupported
+ && HiveConf.getBoolVar(conf, ConfVars.LLAP_IO_ENCODE_ENABLED)) {
+ // See if we can use re-encoding to read the format thru IO elevator.
+ String formatList = HiveConf.getVar(conf, ConfVars.LLAP_IO_ENCODE_FORMATS);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Checking " + ifName + " against " + formatList);
+ }
- String[] formats = StringUtils.getStrings(formatList);
++ String[] formats = org.apache.hadoop.util.StringUtils.getStrings(formatList);
+ if (formats != null) {
+ for (String format : formats) {
+ // TODO: should we check isAssignableFrom?
+ if (ifName.equals(format)) {
+ LOG.info("Using SerDe-based LLAP reader for " + ifName);
+ isSupported = isSerdeBased = true;
+ break;
+ }
+ }
+ }
+ }
if (!isSupported || !isVectorized) {
- LOG.info("Not using llap for " + inputFormat + ": supported = " + isSupported
- + ", vectorized = " + isVectorized);
+ LOG.info("Not using llap for " + ifName + ": supported = "
+ + isSupported + ", vectorized = " + isVectorized);
return inputFormat;
}
if (LOG.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/io/rcfile/stats/PartialScanTask.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
----------------------------------------------------------------------
diff --cc ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index 7514ec4,c5b3517..c812003
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@@ -32,7 -33,7 +33,8 @@@ import java.io.IOException
import java.io.PrintStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Arrays;
+ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@@ -2982,23 -2916,12 +3082,15 @@@ private void constructOneLBLocationMap(
// If we do a rename for a non-local file, we will be transfering the original
// file permissions from source to the destination. Else, in case of mvFile() where we
// copy from source to destination, we will inherit the destination's parent group ownership.
- final String srcGroup = renameNonLocal ? srcFile.getGroup() :
+ final String srcGroup = isRenameAllowed ? srcFile.getGroup() :
fullDestStatus.getFileStatus().getGroup();
if (null == pool) {
- Path destPath = new Path(destf, srcP.getName());
try {
-
- if (renameNonLocal) {
- for (int counter = 1; !destFs.rename(srcP,destPath); counter++) {
- destPath = new Path(destf, name + ("_copy_" + counter) + filetype);
- }
- } else {
- destPath = mvFile(conf, srcP, destPath, isSrcLocal, srcFs, destFs, name, filetype);
- }
+ Path destPath = mvFile(conf, srcFs, srcP, destFs, destf, isSrcLocal, isRenameAllowed);
+ if (inheritPerms) {
+ HdfsUtils.setFullFileStatus(conf, fullDestStatus, srcGroup, destFs, destPath, false);
+ }
if (null != newFiles) {
newFiles.add(destPath);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/748c1bd2/ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java
----------------------------------------------------------------------