You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2014/02/20 00:50:34 UTC
svn commit: r1569985 [7/8] - in /hive/trunk:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/
itests/util/src/main/java/org/apache/hadoop/hive/ql/ metastore/if/
metastore/src/gen/thrift/gen-cpp/
metastore/src/gen/thrift/gen-javabean/org...
Modified: hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py (original)
+++ hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py Wed Feb 19 23:50:32 2014
@@ -652,6 +652,46 @@ class Iface(fb303.FacebookService.Iface)
"""
pass
+ def create_function(self, func):
+ """
+ Parameters:
+ - func
+ """
+ pass
+
+ def drop_function(self, dbName, funcName):
+ """
+ Parameters:
+ - dbName
+ - funcName
+ """
+ pass
+
+ def alter_function(self, dbName, funcName, newFunc):
+ """
+ Parameters:
+ - dbName
+ - funcName
+ - newFunc
+ """
+ pass
+
+ def get_functions(self, dbName, pattern):
+ """
+ Parameters:
+ - dbName
+ - pattern
+ """
+ pass
+
+ def get_function(self, dbName, funcName):
+ """
+ Parameters:
+ - dbName
+ - funcName
+ """
+ pass
+
def create_role(self, role):
"""
Parameters:
@@ -3523,6 +3563,182 @@ class Client(fb303.FacebookService.Clien
raise result.o4
raise TApplicationException(TApplicationException.MISSING_RESULT, "delete_table_column_statistics failed: unknown result");
+ def create_function(self, func):
+ """
+ Parameters:
+ - func
+ """
+ self.send_create_function(func)
+ self.recv_create_function()
+
+ def send_create_function(self, func):
+ self._oprot.writeMessageBegin('create_function', TMessageType.CALL, self._seqid)
+ args = create_function_args()
+ args.func = func
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_create_function(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = create_function_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.o1 is not None:
+ raise result.o1
+ if result.o2 is not None:
+ raise result.o2
+ if result.o3 is not None:
+ raise result.o3
+ if result.o4 is not None:
+ raise result.o4
+ return
+
+ def drop_function(self, dbName, funcName):
+ """
+ Parameters:
+ - dbName
+ - funcName
+ """
+ self.send_drop_function(dbName, funcName)
+ self.recv_drop_function()
+
+ def send_drop_function(self, dbName, funcName):
+ self._oprot.writeMessageBegin('drop_function', TMessageType.CALL, self._seqid)
+ args = drop_function_args()
+ args.dbName = dbName
+ args.funcName = funcName
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_drop_function(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = drop_function_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.o1 is not None:
+ raise result.o1
+ if result.o3 is not None:
+ raise result.o3
+ return
+
+ def alter_function(self, dbName, funcName, newFunc):
+ """
+ Parameters:
+ - dbName
+ - funcName
+ - newFunc
+ """
+ self.send_alter_function(dbName, funcName, newFunc)
+ self.recv_alter_function()
+
+ def send_alter_function(self, dbName, funcName, newFunc):
+ self._oprot.writeMessageBegin('alter_function', TMessageType.CALL, self._seqid)
+ args = alter_function_args()
+ args.dbName = dbName
+ args.funcName = funcName
+ args.newFunc = newFunc
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_alter_function(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = alter_function_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.o1 is not None:
+ raise result.o1
+ if result.o2 is not None:
+ raise result.o2
+ return
+
+ def get_functions(self, dbName, pattern):
+ """
+ Parameters:
+ - dbName
+ - pattern
+ """
+ self.send_get_functions(dbName, pattern)
+ return self.recv_get_functions()
+
+ def send_get_functions(self, dbName, pattern):
+ self._oprot.writeMessageBegin('get_functions', TMessageType.CALL, self._seqid)
+ args = get_functions_args()
+ args.dbName = dbName
+ args.pattern = pattern
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_get_functions(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = get_functions_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success is not None:
+ return result.success
+ if result.o1 is not None:
+ raise result.o1
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "get_functions failed: unknown result");
+
+ def get_function(self, dbName, funcName):
+ """
+ Parameters:
+ - dbName
+ - funcName
+ """
+ self.send_get_function(dbName, funcName)
+ return self.recv_get_function()
+
+ def send_get_function(self, dbName, funcName):
+ self._oprot.writeMessageBegin('get_function', TMessageType.CALL, self._seqid)
+ args = get_function_args()
+ args.dbName = dbName
+ args.funcName = funcName
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_get_function(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = get_function_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success is not None:
+ return result.success
+ if result.o1 is not None:
+ raise result.o1
+ if result.o2 is not None:
+ raise result.o2
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "get_function failed: unknown result");
+
def create_role(self, role):
"""
Parameters:
@@ -4069,6 +4285,11 @@ class Processor(fb303.FacebookService.Pr
self._processMap["get_partitions_statistics_req"] = Processor.process_get_partitions_statistics_req
self._processMap["delete_partition_column_statistics"] = Processor.process_delete_partition_column_statistics
self._processMap["delete_table_column_statistics"] = Processor.process_delete_table_column_statistics
+ self._processMap["create_function"] = Processor.process_create_function
+ self._processMap["drop_function"] = Processor.process_drop_function
+ self._processMap["alter_function"] = Processor.process_alter_function
+ self._processMap["get_functions"] = Processor.process_get_functions
+ self._processMap["get_function"] = Processor.process_get_function
self._processMap["create_role"] = Processor.process_create_role
self._processMap["drop_role"] = Processor.process_drop_role
self._processMap["get_role_names"] = Processor.process_get_role_names
@@ -5329,6 +5550,88 @@ class Processor(fb303.FacebookService.Pr
oprot.writeMessageEnd()
oprot.trans.flush()
+ def process_create_function(self, seqid, iprot, oprot):
+ args = create_function_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = create_function_result()
+ try:
+ self._handler.create_function(args.func)
+ except AlreadyExistsException as o1:
+ result.o1 = o1
+ except InvalidObjectException as o2:
+ result.o2 = o2
+ except MetaException as o3:
+ result.o3 = o3
+ except NoSuchObjectException as o4:
+ result.o4 = o4
+ oprot.writeMessageBegin("create_function", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_drop_function(self, seqid, iprot, oprot):
+ args = drop_function_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = drop_function_result()
+ try:
+ self._handler.drop_function(args.dbName, args.funcName)
+ except NoSuchObjectException as o1:
+ result.o1 = o1
+ except MetaException as o3:
+ result.o3 = o3
+ oprot.writeMessageBegin("drop_function", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_alter_function(self, seqid, iprot, oprot):
+ args = alter_function_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = alter_function_result()
+ try:
+ self._handler.alter_function(args.dbName, args.funcName, args.newFunc)
+ except InvalidOperationException as o1:
+ result.o1 = o1
+ except MetaException as o2:
+ result.o2 = o2
+ oprot.writeMessageBegin("alter_function", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_get_functions(self, seqid, iprot, oprot):
+ args = get_functions_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = get_functions_result()
+ try:
+ result.success = self._handler.get_functions(args.dbName, args.pattern)
+ except MetaException as o1:
+ result.o1 = o1
+ oprot.writeMessageBegin("get_functions", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_get_function(self, seqid, iprot, oprot):
+ args = get_function_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = get_function_result()
+ try:
+ result.success = self._handler.get_function(args.dbName, args.funcName)
+ except MetaException as o1:
+ result.o1 = o1
+ except NoSuchObjectException as o2:
+ result.o2 = o2
+ oprot.writeMessageBegin("get_function", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
def process_create_role(self, seqid, iprot, oprot):
args = create_role_args()
args.read(iprot)
@@ -18221,19 +18524,19 @@ class delete_table_column_statistics_res
def __ne__(self, other):
return not (self == other)
-class create_role_args:
+class create_function_args:
"""
Attributes:
- - role
+ - func
"""
thrift_spec = (
None, # 0
- (1, TType.STRUCT, 'role', (Role, Role.thrift_spec), None, ), # 1
+ (1, TType.STRUCT, 'func', (Function, Function.thrift_spec), None, ), # 1
)
- def __init__(self, role=None,):
- self.role = role
+ def __init__(self, func=None,):
+ self.func = func
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:
@@ -18246,8 +18549,8 @@ class create_role_args:
break
if fid == 1:
if ftype == TType.STRUCT:
- self.role = Role()
- self.role.read(iprot)
+ self.func = Function()
+ self.func.read(iprot)
else:
iprot.skip(ftype)
else:
@@ -18259,10 +18562,10 @@ class create_role_args:
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('create_role_args')
- if self.role is not None:
- oprot.writeFieldBegin('role', TType.STRUCT, 1)
- self.role.write(oprot)
+ oprot.writeStructBegin('create_function_args')
+ if self.func is not None:
+ oprot.writeFieldBegin('func', TType.STRUCT, 1)
+ self.func.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
@@ -18282,21 +18585,28 @@ class create_role_args:
def __ne__(self, other):
return not (self == other)
-class create_role_result:
+class create_function_result:
"""
Attributes:
- - success
- o1
+ - o2
+ - o3
+ - o4
"""
thrift_spec = (
- (0, TType.BOOL, 'success', None, None, ), # 0
- (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1
+ None, # 0
+ (1, TType.STRUCT, 'o1', (AlreadyExistsException, AlreadyExistsException.thrift_spec), None, ), # 1
+ (2, TType.STRUCT, 'o2', (InvalidObjectException, InvalidObjectException.thrift_spec), None, ), # 2
+ (3, TType.STRUCT, 'o3', (MetaException, MetaException.thrift_spec), None, ), # 3
+ (4, TType.STRUCT, 'o4', (NoSuchObjectException, NoSuchObjectException.thrift_spec), None, ), # 4
)
- def __init__(self, success=None, o1=None,):
- self.success = success
+ def __init__(self, o1=None, o2=None, o3=None, o4=None,):
self.o1 = o1
+ self.o2 = o2
+ self.o3 = o3
+ self.o4 = o4
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:
@@ -18307,15 +18617,28 @@ class create_role_result:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
- if fid == 0:
- if ftype == TType.BOOL:
- self.success = iprot.readBool();
+ if fid == 1:
+ if ftype == TType.STRUCT:
+ self.o1 = AlreadyExistsException()
+ self.o1.read(iprot)
else:
iprot.skip(ftype)
- elif fid == 1:
+ elif fid == 2:
if ftype == TType.STRUCT:
- self.o1 = MetaException()
- self.o1.read(iprot)
+ self.o2 = InvalidObjectException()
+ self.o2.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.STRUCT:
+ self.o3 = MetaException()
+ self.o3.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.STRUCT:
+ self.o4 = NoSuchObjectException()
+ self.o4.read(iprot)
else:
iprot.skip(ftype)
else:
@@ -18327,9 +18650,765 @@ class create_role_result:
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('create_role_result')
- if self.success is not None:
- oprot.writeFieldBegin('success', TType.BOOL, 0)
+ oprot.writeStructBegin('create_function_result')
+ if self.o1 is not None:
+ oprot.writeFieldBegin('o1', TType.STRUCT, 1)
+ self.o1.write(oprot)
+ oprot.writeFieldEnd()
+ if self.o2 is not None:
+ oprot.writeFieldBegin('o2', TType.STRUCT, 2)
+ self.o2.write(oprot)
+ oprot.writeFieldEnd()
+ if self.o3 is not None:
+ oprot.writeFieldBegin('o3', TType.STRUCT, 3)
+ self.o3.write(oprot)
+ oprot.writeFieldEnd()
+ if self.o4 is not None:
+ oprot.writeFieldBegin('o4', TType.STRUCT, 4)
+ self.o4.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 drop_function_args:
+ """
+ Attributes:
+ - dbName
+ - funcName
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'dbName', None, None, ), # 1
+ (2, TType.STRING, 'funcName', None, None, ), # 2
+ )
+
+ def __init__(self, dbName=None, funcName=None,):
+ self.dbName = dbName
+ self.funcName = funcName
+
+ 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.funcName = 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('drop_function_args')
+ if self.dbName is not None:
+ oprot.writeFieldBegin('dbName', TType.STRING, 1)
+ oprot.writeString(self.dbName)
+ oprot.writeFieldEnd()
+ if self.funcName is not None:
+ oprot.writeFieldBegin('funcName', TType.STRING, 2)
+ oprot.writeString(self.funcName)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 drop_function_result:
+ """
+ Attributes:
+ - o1
+ - o3
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'o1', (NoSuchObjectException, NoSuchObjectException.thrift_spec), None, ), # 1
+ (2, TType.STRUCT, 'o3', (MetaException, MetaException.thrift_spec), None, ), # 2
+ )
+
+ def __init__(self, o1=None, o3=None,):
+ self.o1 = o1
+ self.o3 = o3
+
+ 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.o1 = NoSuchObjectException()
+ self.o1.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRUCT:
+ self.o3 = MetaException()
+ self.o3.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('drop_function_result')
+ if self.o1 is not None:
+ oprot.writeFieldBegin('o1', TType.STRUCT, 1)
+ self.o1.write(oprot)
+ oprot.writeFieldEnd()
+ if self.o3 is not None:
+ oprot.writeFieldBegin('o3', TType.STRUCT, 2)
+ self.o3.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 alter_function_args:
+ """
+ Attributes:
+ - dbName
+ - funcName
+ - newFunc
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'dbName', None, None, ), # 1
+ (2, TType.STRING, 'funcName', None, None, ), # 2
+ (3, TType.STRUCT, 'newFunc', (Function, Function.thrift_spec), None, ), # 3
+ )
+
+ def __init__(self, dbName=None, funcName=None, newFunc=None,):
+ self.dbName = dbName
+ self.funcName = funcName
+ self.newFunc = newFunc
+
+ 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.funcName = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.STRUCT:
+ self.newFunc = Function()
+ self.newFunc.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('alter_function_args')
+ if self.dbName is not None:
+ oprot.writeFieldBegin('dbName', TType.STRING, 1)
+ oprot.writeString(self.dbName)
+ oprot.writeFieldEnd()
+ if self.funcName is not None:
+ oprot.writeFieldBegin('funcName', TType.STRING, 2)
+ oprot.writeString(self.funcName)
+ oprot.writeFieldEnd()
+ if self.newFunc is not None:
+ oprot.writeFieldBegin('newFunc', TType.STRUCT, 3)
+ self.newFunc.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 alter_function_result:
+ """
+ Attributes:
+ - o1
+ - o2
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'o1', (InvalidOperationException, InvalidOperationException.thrift_spec), None, ), # 1
+ (2, TType.STRUCT, 'o2', (MetaException, MetaException.thrift_spec), None, ), # 2
+ )
+
+ def __init__(self, o1=None, o2=None,):
+ self.o1 = o1
+ self.o2 = o2
+
+ 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.o1 = InvalidOperationException()
+ self.o1.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRUCT:
+ self.o2 = MetaException()
+ self.o2.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('alter_function_result')
+ if self.o1 is not None:
+ oprot.writeFieldBegin('o1', TType.STRUCT, 1)
+ self.o1.write(oprot)
+ oprot.writeFieldEnd()
+ if self.o2 is not None:
+ oprot.writeFieldBegin('o2', TType.STRUCT, 2)
+ self.o2.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 get_functions_args:
+ """
+ Attributes:
+ - dbName
+ - pattern
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'dbName', None, None, ), # 1
+ (2, TType.STRING, 'pattern', None, None, ), # 2
+ )
+
+ def __init__(self, dbName=None, pattern=None,):
+ self.dbName = dbName
+ self.pattern = pattern
+
+ 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.pattern = 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('get_functions_args')
+ if self.dbName is not None:
+ oprot.writeFieldBegin('dbName', TType.STRING, 1)
+ oprot.writeString(self.dbName)
+ oprot.writeFieldEnd()
+ if self.pattern is not None:
+ oprot.writeFieldBegin('pattern', TType.STRING, 2)
+ oprot.writeString(self.pattern)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 get_functions_result:
+ """
+ Attributes:
+ - success
+ - o1
+ """
+
+ thrift_spec = (
+ (0, TType.LIST, 'success', (TType.STRING,None), None, ), # 0
+ (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, success=None, o1=None,):
+ self.success = success
+ self.o1 = o1
+
+ 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 == 0:
+ if ftype == TType.LIST:
+ self.success = []
+ (_etype620, _size617) = iprot.readListBegin()
+ for _i621 in xrange(_size617):
+ _elem622 = iprot.readString();
+ self.success.append(_elem622)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ elif fid == 1:
+ if ftype == TType.STRUCT:
+ self.o1 = MetaException()
+ self.o1.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('get_functions_result')
+ if self.success is not None:
+ oprot.writeFieldBegin('success', TType.LIST, 0)
+ oprot.writeListBegin(TType.STRING, len(self.success))
+ for iter623 in self.success:
+ oprot.writeString(iter623)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ if self.o1 is not None:
+ oprot.writeFieldBegin('o1', TType.STRUCT, 1)
+ self.o1.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 get_function_args:
+ """
+ Attributes:
+ - dbName
+ - funcName
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'dbName', None, None, ), # 1
+ (2, TType.STRING, 'funcName', None, None, ), # 2
+ )
+
+ def __init__(self, dbName=None, funcName=None,):
+ self.dbName = dbName
+ self.funcName = funcName
+
+ 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.funcName = 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('get_function_args')
+ if self.dbName is not None:
+ oprot.writeFieldBegin('dbName', TType.STRING, 1)
+ oprot.writeString(self.dbName)
+ oprot.writeFieldEnd()
+ if self.funcName is not None:
+ oprot.writeFieldBegin('funcName', TType.STRING, 2)
+ oprot.writeString(self.funcName)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 get_function_result:
+ """
+ Attributes:
+ - success
+ - o1
+ - o2
+ """
+
+ thrift_spec = (
+ (0, TType.STRUCT, 'success', (Function, Function.thrift_spec), None, ), # 0
+ (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1
+ (2, TType.STRUCT, 'o2', (NoSuchObjectException, NoSuchObjectException.thrift_spec), None, ), # 2
+ )
+
+ def __init__(self, success=None, o1=None, o2=None,):
+ self.success = success
+ self.o1 = o1
+ self.o2 = o2
+
+ 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 == 0:
+ if ftype == TType.STRUCT:
+ self.success = Function()
+ self.success.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 1:
+ if ftype == TType.STRUCT:
+ self.o1 = MetaException()
+ self.o1.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRUCT:
+ self.o2 = NoSuchObjectException()
+ self.o2.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('get_function_result')
+ if self.success is not None:
+ oprot.writeFieldBegin('success', TType.STRUCT, 0)
+ self.success.write(oprot)
+ oprot.writeFieldEnd()
+ if self.o1 is not None:
+ oprot.writeFieldBegin('o1', TType.STRUCT, 1)
+ self.o1.write(oprot)
+ oprot.writeFieldEnd()
+ if self.o2 is not None:
+ oprot.writeFieldBegin('o2', TType.STRUCT, 2)
+ self.o2.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 create_role_args:
+ """
+ Attributes:
+ - role
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'role', (Role, Role.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, role=None,):
+ self.role = role
+
+ 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.role = Role()
+ self.role.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('create_role_args')
+ if self.role is not None:
+ oprot.writeFieldBegin('role', TType.STRUCT, 1)
+ self.role.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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 create_role_result:
+ """
+ Attributes:
+ - success
+ - o1
+ """
+
+ thrift_spec = (
+ (0, TType.BOOL, 'success', None, None, ), # 0
+ (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, success=None, o1=None,):
+ self.success = success
+ self.o1 = o1
+
+ 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 == 0:
+ if ftype == TType.BOOL:
+ self.success = iprot.readBool();
+ else:
+ iprot.skip(ftype)
+ elif fid == 1:
+ if ftype == TType.STRUCT:
+ self.o1 = MetaException()
+ self.o1.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('create_role_result')
+ if self.success is not None:
+ oprot.writeFieldBegin('success', TType.BOOL, 0)
oprot.writeBool(self.success)
oprot.writeFieldEnd()
if self.o1 is not None:
@@ -18556,10 +19635,10 @@ class get_role_names_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype620, _size617) = iprot.readListBegin()
- for _i621 in xrange(_size617):
- _elem622 = iprot.readString();
- self.success.append(_elem622)
+ (_etype627, _size624) = iprot.readListBegin()
+ for _i628 in xrange(_size624):
+ _elem629 = iprot.readString();
+ self.success.append(_elem629)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -18582,8 +19661,8 @@ class get_role_names_result:
if self.success is not None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRING, len(self.success))
- for iter623 in self.success:
- oprot.writeString(iter623)
+ for iter630 in self.success:
+ oprot.writeString(iter630)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.o1 is not None:
@@ -19056,11 +20135,11 @@ class list_roles_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype627, _size624) = iprot.readListBegin()
- for _i628 in xrange(_size624):
- _elem629 = Role()
- _elem629.read(iprot)
- self.success.append(_elem629)
+ (_etype634, _size631) = iprot.readListBegin()
+ for _i635 in xrange(_size631):
+ _elem636 = Role()
+ _elem636.read(iprot)
+ self.success.append(_elem636)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -19083,8 +20162,8 @@ class list_roles_result:
if self.success is not None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter630 in self.success:
- iter630.write(oprot)
+ for iter637 in self.success:
+ iter637.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.o1 is not None:
@@ -19152,10 +20231,10 @@ class get_privilege_set_args:
elif fid == 3:
if ftype == TType.LIST:
self.group_names = []
- (_etype634, _size631) = iprot.readListBegin()
- for _i635 in xrange(_size631):
- _elem636 = iprot.readString();
- self.group_names.append(_elem636)
+ (_etype641, _size638) = iprot.readListBegin()
+ for _i642 in xrange(_size638):
+ _elem643 = iprot.readString();
+ self.group_names.append(_elem643)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -19180,8 +20259,8 @@ class get_privilege_set_args:
if self.group_names is not None:
oprot.writeFieldBegin('group_names', TType.LIST, 3)
oprot.writeListBegin(TType.STRING, len(self.group_names))
- for iter637 in self.group_names:
- oprot.writeString(iter637)
+ for iter644 in self.group_names:
+ oprot.writeString(iter644)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -19388,11 +20467,11 @@ class list_privileges_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype641, _size638) = iprot.readListBegin()
- for _i642 in xrange(_size638):
- _elem643 = HiveObjectPrivilege()
- _elem643.read(iprot)
- self.success.append(_elem643)
+ (_etype648, _size645) = iprot.readListBegin()
+ for _i649 in xrange(_size645):
+ _elem650 = HiveObjectPrivilege()
+ _elem650.read(iprot)
+ self.success.append(_elem650)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -19415,8 +20494,8 @@ class list_privileges_result:
if self.success is not None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter644 in self.success:
- iter644.write(oprot)
+ for iter651 in self.success:
+ iter651.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.o1 is not None:
@@ -19741,10 +20820,10 @@ class set_ugi_args:
elif fid == 2:
if ftype == TType.LIST:
self.group_names = []
- (_etype648, _size645) = iprot.readListBegin()
- for _i649 in xrange(_size645):
- _elem650 = iprot.readString();
- self.group_names.append(_elem650)
+ (_etype655, _size652) = iprot.readListBegin()
+ for _i656 in xrange(_size652):
+ _elem657 = iprot.readString();
+ self.group_names.append(_elem657)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -19765,8 +20844,8 @@ class set_ugi_args:
if self.group_names is not None:
oprot.writeFieldBegin('group_names', TType.LIST, 2)
oprot.writeListBegin(TType.STRING, len(self.group_names))
- for iter651 in self.group_names:
- oprot.writeString(iter651)
+ for iter658 in self.group_names:
+ oprot.writeString(iter658)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -19815,10 +20894,10 @@ class set_ugi_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype655, _size652) = iprot.readListBegin()
- for _i656 in xrange(_size652):
- _elem657 = iprot.readString();
- self.success.append(_elem657)
+ (_etype662, _size659) = iprot.readListBegin()
+ for _i663 in xrange(_size659):
+ _elem664 = iprot.readString();
+ self.success.append(_elem664)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -19841,8 +20920,8 @@ class set_ugi_result:
if self.success is not None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRING, len(self.success))
- for iter658 in self.success:
- oprot.writeString(iter658)
+ for iter665 in self.success:
+ oprot.writeString(iter665)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.o1 is not None:
Modified: hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py (original)
+++ hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py Wed Feb 19 23:50:32 2014
@@ -69,6 +69,17 @@ class PartitionEventType:
"LOAD_DONE": 1,
}
+class FunctionType:
+ JAVA = 1
+
+ _VALUES_TO_NAMES = {
+ 1: "JAVA",
+ }
+
+ _NAMES_TO_VALUES = {
+ "JAVA": 1,
+ }
+
class Version:
"""
@@ -4444,6 +4455,138 @@ class DropPartitionsRequest:
def __ne__(self, other):
return not (self == other)
+class Function:
+ """
+ Attributes:
+ - functionName
+ - dbName
+ - className
+ - ownerName
+ - ownerType
+ - createTime
+ - functionType
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'functionName', None, None, ), # 1
+ (2, TType.STRING, 'dbName', None, None, ), # 2
+ (3, TType.STRING, 'className', None, None, ), # 3
+ (4, TType.STRING, 'ownerName', None, None, ), # 4
+ (5, TType.I32, 'ownerType', None, None, ), # 5
+ (6, TType.I32, 'createTime', None, None, ), # 6
+ (7, TType.I32, 'functionType', None, None, ), # 7
+ )
+
+ def __init__(self, functionName=None, dbName=None, className=None, ownerName=None, ownerType=None, createTime=None, functionType=None,):
+ self.functionName = functionName
+ self.dbName = dbName
+ self.className = className
+ self.ownerName = ownerName
+ self.ownerType = ownerType
+ self.createTime = createTime
+ self.functionType = functionType
+
+ 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.functionName = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.dbName = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.STRING:
+ self.className = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.STRING:
+ self.ownerName = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 5:
+ if ftype == TType.I32:
+ self.ownerType = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 6:
+ if ftype == TType.I32:
+ self.createTime = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 7:
+ if ftype == TType.I32:
+ self.functionType = iprot.readI32();
+ 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('Function')
+ if self.functionName is not None:
+ oprot.writeFieldBegin('functionName', TType.STRING, 1)
+ oprot.writeString(self.functionName)
+ oprot.writeFieldEnd()
+ if self.dbName is not None:
+ oprot.writeFieldBegin('dbName', TType.STRING, 2)
+ oprot.writeString(self.dbName)
+ oprot.writeFieldEnd()
+ if self.className is not None:
+ oprot.writeFieldBegin('className', TType.STRING, 3)
+ oprot.writeString(self.className)
+ oprot.writeFieldEnd()
+ if self.ownerName is not None:
+ oprot.writeFieldBegin('ownerName', TType.STRING, 4)
+ oprot.writeString(self.ownerName)
+ oprot.writeFieldEnd()
+ if self.ownerType is not None:
+ oprot.writeFieldBegin('ownerType', TType.I32, 5)
+ oprot.writeI32(self.ownerType)
+ oprot.writeFieldEnd()
+ if self.createTime is not None:
+ oprot.writeFieldBegin('createTime', TType.I32, 6)
+ oprot.writeI32(self.createTime)
+ oprot.writeFieldEnd()
+ if self.functionType is not None:
+ oprot.writeFieldBegin('functionType', TType.I32, 7)
+ oprot.writeI32(self.functionType)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ 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:
Modified: hive/trunk/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb (original)
+++ hive/trunk/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb Wed Feb 19 23:50:32 2014
@@ -32,6 +32,12 @@ module PartitionEventType
VALID_VALUES = Set.new([LOAD_DONE]).freeze
end
+module FunctionType
+ JAVA = 1
+ VALUE_MAP = {1 => "JAVA"}
+ VALID_VALUES = Set.new([JAVA]).freeze
+end
+
class Version
include ::Thrift::Struct, ::Thrift::Struct_Union
VERSION = 1
@@ -1014,6 +1020,40 @@ class DropPartitionsRequest
::Thrift::Struct.generate_accessors self
end
+class Function
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ FUNCTIONNAME = 1
+ DBNAME = 2
+ CLASSNAME = 3
+ OWNERNAME = 4
+ OWNERTYPE = 5
+ CREATETIME = 6
+ FUNCTIONTYPE = 7
+
+ FIELDS = {
+ FUNCTIONNAME => {:type => ::Thrift::Types::STRING, :name => 'functionName'},
+ DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'},
+ CLASSNAME => {:type => ::Thrift::Types::STRING, :name => 'className'},
+ OWNERNAME => {:type => ::Thrift::Types::STRING, :name => 'ownerName'},
+ OWNERTYPE => {:type => ::Thrift::Types::I32, :name => 'ownerType', :enum_class => ::PrincipalType},
+ CREATETIME => {:type => ::Thrift::Types::I32, :name => 'createTime'},
+ FUNCTIONTYPE => {:type => ::Thrift::Types::I32, :name => 'functionType', :enum_class => ::FunctionType}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ unless @ownerType.nil? || ::PrincipalType::VALID_VALUES.include?(@ownerType)
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field ownerType!')
+ end
+ unless @functionType.nil? || ::FunctionType::VALID_VALUES.include?(@functionType)
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field functionType!')
+ end
+ end
+
+ ::Thrift::Struct.generate_accessors self
+end
+
class MetaException < ::Thrift::Exception
include ::Thrift::Struct, ::Thrift::Struct_Union
def initialize(message=nil)
Modified: hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb (original)
+++ hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb Wed Feb 19 23:50:32 2014
@@ -1269,6 +1269,89 @@ module ThriftHiveMetastore
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'delete_table_column_statistics failed: unknown result')
end
+ def create_function(func)
+ send_create_function(func)
+ recv_create_function()
+ end
+
+ def send_create_function(func)
+ send_message('create_function', Create_function_args, :func => func)
+ end
+
+ def recv_create_function()
+ result = receive_message(Create_function_result)
+ 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?
+ return
+ end
+
+ def drop_function(dbName, funcName)
+ send_drop_function(dbName, funcName)
+ recv_drop_function()
+ end
+
+ def send_drop_function(dbName, funcName)
+ send_message('drop_function', Drop_function_args, :dbName => dbName, :funcName => funcName)
+ end
+
+ def recv_drop_function()
+ result = receive_message(Drop_function_result)
+ raise result.o1 unless result.o1.nil?
+ raise result.o3 unless result.o3.nil?
+ return
+ end
+
+ def alter_function(dbName, funcName, newFunc)
+ send_alter_function(dbName, funcName, newFunc)
+ recv_alter_function()
+ end
+
+ def send_alter_function(dbName, funcName, newFunc)
+ send_message('alter_function', Alter_function_args, :dbName => dbName, :funcName => funcName, :newFunc => newFunc)
+ end
+
+ def recv_alter_function()
+ result = receive_message(Alter_function_result)
+ raise result.o1 unless result.o1.nil?
+ raise result.o2 unless result.o2.nil?
+ return
+ end
+
+ def get_functions(dbName, pattern)
+ send_get_functions(dbName, pattern)
+ return recv_get_functions()
+ end
+
+ def send_get_functions(dbName, pattern)
+ send_message('get_functions', Get_functions_args, :dbName => dbName, :pattern => pattern)
+ end
+
+ def recv_get_functions()
+ result = receive_message(Get_functions_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_functions failed: unknown result')
+ end
+
+ def get_function(dbName, funcName)
+ send_get_function(dbName, funcName)
+ return recv_get_function()
+ end
+
+ def send_get_function(dbName, funcName)
+ send_message('get_function', Get_function_args, :dbName => dbName, :funcName => funcName)
+ end
+
+ def recv_get_function()
+ result = receive_message(Get_function_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise result.o2 unless result.o2.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_function failed: unknown result')
+ end
+
def create_role(role)
send_create_role(role)
return recv_create_role()
@@ -2508,6 +2591,73 @@ module ThriftHiveMetastore
write_result(result, oprot, 'delete_table_column_statistics', seqid)
end
+ def process_create_function(seqid, iprot, oprot)
+ args = read_args(iprot, Create_function_args)
+ result = Create_function_result.new()
+ begin
+ @handler.create_function(args.func)
+ rescue ::AlreadyExistsException => o1
+ result.o1 = o1
+ rescue ::InvalidObjectException => o2
+ result.o2 = o2
+ rescue ::MetaException => o3
+ result.o3 = o3
+ rescue ::NoSuchObjectException => o4
+ result.o4 = o4
+ end
+ write_result(result, oprot, 'create_function', seqid)
+ end
+
+ def process_drop_function(seqid, iprot, oprot)
+ args = read_args(iprot, Drop_function_args)
+ result = Drop_function_result.new()
+ begin
+ @handler.drop_function(args.dbName, args.funcName)
+ rescue ::NoSuchObjectException => o1
+ result.o1 = o1
+ rescue ::MetaException => o3
+ result.o3 = o3
+ end
+ write_result(result, oprot, 'drop_function', seqid)
+ end
+
+ def process_alter_function(seqid, iprot, oprot)
+ args = read_args(iprot, Alter_function_args)
+ result = Alter_function_result.new()
+ begin
+ @handler.alter_function(args.dbName, args.funcName, args.newFunc)
+ rescue ::InvalidOperationException => o1
+ result.o1 = o1
+ rescue ::MetaException => o2
+ result.o2 = o2
+ end
+ write_result(result, oprot, 'alter_function', seqid)
+ end
+
+ def process_get_functions(seqid, iprot, oprot)
+ args = read_args(iprot, Get_functions_args)
+ result = Get_functions_result.new()
+ begin
+ result.success = @handler.get_functions(args.dbName, args.pattern)
+ rescue ::MetaException => o1
+ result.o1 = o1
+ end
+ write_result(result, oprot, 'get_functions', seqid)
+ end
+
+ def process_get_function(seqid, iprot, oprot)
+ args = read_args(iprot, Get_function_args)
+ result = Get_function_result.new()
+ begin
+ result.success = @handler.get_function(args.dbName, args.funcName)
+ rescue ::MetaException => o1
+ result.o1 = o1
+ rescue ::NoSuchObjectException => o2
+ result.o2 = o2
+ end
+ write_result(result, oprot, 'get_function', seqid)
+ end
+
def process_create_role(seqid, iprot, oprot)
args = read_args(iprot, Create_role_args)
result = Create_role_result.new()
@@ -5577,6 +5727,192 @@ module ThriftHiveMetastore
::Thrift::Struct.generate_accessors self
end
+ class Create_function_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ FUNC = 1
+
+ FIELDS = {
+ FUNC => {:type => ::Thrift::Types::STRUCT, :name => 'func', :class => ::Function}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Create_function_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ O1 = 1
+ O2 = 2
+ O3 = 3
+ O4 = 4
+
+ FIELDS = {
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::AlreadyExistsException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::InvalidObjectException},
+ O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::MetaException},
+ O4 => {:type => ::Thrift::Types::STRUCT, :name => 'o4', :class => ::NoSuchObjectException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Drop_function_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ DBNAME = 1
+ FUNCNAME = 2
+
+ FIELDS = {
+ DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'},
+ FUNCNAME => {:type => ::Thrift::Types::STRING, :name => 'funcName'}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Drop_function_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ O1 = 1
+ O3 = 2
+
+ FIELDS = {
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::NoSuchObjectException},
+ O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Alter_function_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ DBNAME = 1
+ FUNCNAME = 2
+ NEWFUNC = 3
+
+ FIELDS = {
+ DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'},
+ FUNCNAME => {:type => ::Thrift::Types::STRING, :name => 'funcName'},
+ NEWFUNC => {:type => ::Thrift::Types::STRUCT, :name => 'newFunc', :class => ::Function}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Alter_function_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ O1 = 1
+ O2 = 2
+
+ FIELDS = {
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::InvalidOperationException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Get_functions_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ DBNAME = 1
+ PATTERN = 2
+
+ FIELDS = {
+ DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'},
+ PATTERN => {:type => ::Thrift::Types::STRING, :name => 'pattern'}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Get_functions_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Get_function_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ DBNAME = 1
+ FUNCNAME = 2
+
+ FIELDS = {
+ DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'},
+ FUNCNAME => {:type => ::Thrift::Types::STRING, :name => 'funcName'}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class Get_function_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+ O2 = 2
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Function},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException},
+ O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::NoSuchObjectException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
class Create_role_args
include ::Thrift::Struct, ::Thrift::Struct_Union
ROLE = 1
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Wed Feb 19 23:50:32 2014
@@ -51,6 +51,7 @@ import org.apache.commons.logging.LogFac
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.common.FileUtils;
+import org.apache.hadoop.hive.common.JavaUtils;
import org.apache.hadoop.hive.common.LogUtils;
import org.apache.hadoop.hive.common.LogUtils.LogInitializationException;
import org.apache.hadoop.hive.common.classification.InterfaceAudience;
@@ -72,6 +73,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.api.DropPartitionsResult;
import org.apache.hadoop.hive.metastore.api.EnvironmentContext;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.Function;
import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
import org.apache.hadoop.hive.metastore.api.HiveObjectType;
@@ -797,8 +799,17 @@ public class HiveMetaStore extends Thrif
firePreEvent(new PreDropDatabaseEvent(db, this));
List<String> allTables = get_all_tables(db.getName());
- if (!cascade && !allTables.isEmpty()) {
- throw new InvalidOperationException("Database " + db.getName() + " is not empty");
+ List<String> allFunctions = get_functions(db.getName(), "*");
+
+ if (!cascade) {
+ if (!allTables.isEmpty()) {
+ throw new InvalidOperationException(
+ "Database " + db.getName() + " is not empty. One or more tables exist.");
+ }
+ if (!allFunctions.isEmpty()) {
+ throw new InvalidOperationException(
+ "Database " + db.getName() + " is not empty. One or more functions exist.");
+ }
}
Path path = new Path(db.getLocationUri()).getParent();
if (!wh.isWritable(path)) {
@@ -809,7 +820,12 @@ public class HiveMetaStore extends Thrif
Path databasePath = wh.getDnsPath(wh.getDatabasePath(db));
- // first drop tables
+ // drop any functions before dropping db
+ for (String funcName : allFunctions) {
+ drop_function(name, funcName);
+ }
+
+ // drop tables before dropping db
int tableBatchSize = HiveConf.getIntVar(hiveConf,
ConfVars.METASTORE_BATCH_RETRIEVE_MAX);
@@ -4557,6 +4573,149 @@ public class HiveMetaStore extends Thrif
me.initCause(e);
return me;
}
+
+ private void validateFunctionInfo(Function func) throws InvalidObjectException, MetaException {
+ if (!MetaStoreUtils.validateName(func.getFunctionName())) {
+ throw new InvalidObjectException(func.getFunctionName() + " is not a valid object name");
+ }
+ String className = func.getClassName();
+ if (className == null) {
+ throw new InvalidObjectException("Function class name cannot be null");
+ }
+
+ // Not sure if we can verify that the class is actually a UDF,
+ // since from metastore we do not have access to ql where UDF classes live.
+ // We can at least verify that the class name is a valid class.
+ try {
+ Class<?> functionClass = Class.forName(className, true, JavaUtils.getClassLoader());
+ if (functionClass == null) {
+ throw new ClassNotFoundException(className + " was null");
+ }
+ } catch (ClassNotFoundException e) {
+ throw new MetaException("Cannot load class " + className + " for function "
+ + func.getDbName() + "." + func.getFunctionName() + ": " + e);
+ }
+ }
+
+ @Override
+ public void create_function(Function func) throws AlreadyExistsException,
+ InvalidObjectException, MetaException, NoSuchObjectException,
+ TException {
+ validateFunctionInfo(func);
+
+ boolean success = false;
+ RawStore ms = getMS();
+ try {
+ ms.openTransaction();
+
+ Database db = ms.getDatabase(func.getDbName());
+ if (db == null) {
+ throw new NoSuchObjectException("The database " + func.getDbName() + " does not exist");
+ }
+ Function existingFunc = ms.getFunction(func.getDbName(), func.getFunctionName());
+ if (existingFunc != null) {
+ throw new AlreadyExistsException(
+ "Function " + func.getFunctionName() + " already exists");
+ }
+
+ // set create time
+ long time = System.currentTimeMillis() / 1000;
+ func.setCreateTime((int) time);
+ ms.createFunction(func);
+ success = ms.commitTransaction();
+ } finally {
+ if (!success) {
+ ms.rollbackTransaction();
+ }
+ }
+ }
+
+ @Override
+ public void drop_function(String dbName, String funcName)
+ throws NoSuchObjectException, MetaException,
+ InvalidObjectException, InvalidInputException {
+ boolean success = false;
+ Function func = null;
+ RawStore ms = getMS();
+
+ try {
+ ms.openTransaction();
+
+ func = ms.getFunction(dbName, funcName);
+ if (func == null) {
+ throw new NoSuchObjectException("Function " + funcName + " does not exist");
+ }
+ ms.dropFunction(dbName, funcName);
+ success = ms.commitTransaction();
+ } finally {
+ if (!success) {
+ ms.rollbackTransaction();
+ }
+ }
+ }
+
+ @Override
+ public void alter_function(String dbName, String funcName, Function newFunc)
+ throws InvalidOperationException, MetaException, TException {
+ validateFunctionInfo(newFunc);
+ boolean success = false;
+ RawStore ms = getMS();
+ try {
+ ms.openTransaction();
+ ms.alterFunction(dbName, funcName, newFunc);
+ success = ms.commitTransaction();
+ } finally {
+ if (!success) {
+ ms.rollbackTransaction();
+ }
+ }
+ }
+
+ @Override
+ public List<String> get_functions(String dbName, String pattern)
+ throws MetaException {
+ startFunction("get_functions", ": db=" + dbName + " pat=" + pattern);
+
+ RawStore ms = getMS();
+ Exception ex = null;
+ List<String> funcNames = null;
+
+ try {
+ funcNames = ms.getFunctions(dbName, pattern);
+ } catch (Exception e) {
+ ex = e;
+ throw newMetaException(e);
+ } finally {
+ endFunction("get_functions", funcNames != null, ex);
+ }
+
+ return funcNames;
+ }
+
+ @Override
+ public Function get_function(String dbName, String funcName)
+ throws MetaException, NoSuchObjectException, TException {
+ startFunction("get_function", ": " + dbName + "." + funcName);
+
+ RawStore ms = getMS();
+ Function func = null;
+ Exception ex = null;
+
+ try {
+ func = ms.getFunction(dbName, funcName);
+ if (func == null) {
+ throw new NoSuchObjectException(
+ "Function " + dbName + "." + funcName + " does not exist");
+ }
+ } catch (Exception e) {
+ ex = e;
+ throw newMetaException(e);
+ } finally {
+ endFunction("get_database", func != null, ex);
+ }
+
+ return func;
+ }
}
public static IHMSHandler newHMSHandler(String name, HiveConf hiveConf) throws MetaException {
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java Wed Feb 19 23:50:32 2014
@@ -58,6 +58,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.api.DropPartitionsResult;
import org.apache.hadoop.hive.metastore.api.EnvironmentContext;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.Function;
import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
import org.apache.hadoop.hive.metastore.api.Index;
@@ -1289,6 +1290,14 @@ public class HiveMetaStoreClient impleme
return copy;
}
+ private Function deepCopy(Function func) {
+ Function copy = null;
+ if (func != null) {
+ copy = new Function(func);
+ }
+ return copy;
+ }
+
private List<Partition> deepCopyPartitions(List<Partition> partitions) {
return deepCopyPartitions(partitions, null);
}
@@ -1491,4 +1500,35 @@ public class HiveMetaStoreClient impleme
assert partKVs != null;
return client.isPartitionMarkedForEvent(db_name, tbl_name, partKVs, eventType);
}
+
+ @Override
+ public void createFunction(Function func) throws InvalidObjectException,
+ MetaException, TException {
+ client.create_function(func);
+ }
+
+ @Override
+ public void alterFunction(String dbName, String funcName, Function newFunction)
+ throws InvalidObjectException, MetaException, TException {
+ client.alter_function(dbName, funcName, newFunction);
+ }
+
+ @Override
+ public void dropFunction(String dbName, String funcName)
+ throws MetaException, NoSuchObjectException, InvalidObjectException,
+ InvalidInputException, TException {
+ client.drop_function(dbName, funcName);
+ }
+
+ @Override
+ public Function getFunction(String dbName, String funcName)
+ throws MetaException, TException {
+ return deepCopy(client.get_function(dbName, funcName));
+ }
+
+ @Override
+ public List<String> getFunctions(String dbName, String pattern)
+ throws MetaException, TException {
+ return client.get_functions(dbName, pattern);
+ }
}
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java Wed Feb 19 23:50:32 2014
@@ -28,6 +28,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.Function;
import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
import org.apache.hadoop.hive.metastore.api.Index;
@@ -1004,6 +1005,21 @@ public interface IMetaStoreClient {
*/
public void cancelDelegationToken(String tokenStrForm) throws MetaException, TException;
+ public void createFunction(Function func)
+ throws InvalidObjectException, MetaException, TException;
+
+ public void alterFunction(String dbName, String funcName, Function newFunction)
+ throws InvalidObjectException, MetaException, TException;
+
+ public void dropFunction(String dbName, String funcName) throws MetaException,
+ NoSuchObjectException, InvalidObjectException, InvalidInputException, TException;
+
+ public Function getFunction(String dbName, String funcName)
+ throws MetaException, TException;
+
+ public List<String> getFunctions(String dbName, String pattern)
+ throws MetaException, TException;
+
public class IncompatibleMetastoreException extends MetaException {
public IncompatibleMetastoreException(String message) {
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java Wed Feb 19 23:50:32 2014
@@ -71,6 +71,8 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.DoubleColumnStatsData;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.Function;
+import org.apache.hadoop.hive.metastore.api.FunctionType;
import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
import org.apache.hadoop.hive.metastore.api.HiveObjectType;
@@ -103,6 +105,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.model.MDatabase;
import org.apache.hadoop.hive.metastore.model.MDelegationToken;
import org.apache.hadoop.hive.metastore.model.MFieldSchema;
+import org.apache.hadoop.hive.metastore.model.MFunction;
import org.apache.hadoop.hive.metastore.model.MGlobalPrivilege;
import org.apache.hadoop.hive.metastore.model.MIndex;
import org.apache.hadoop.hive.metastore.model.MMasterKey;
@@ -6374,4 +6377,188 @@ public class ObjectStore implements RawS
}
return sb.toString();
}
+
+ private Function convertToFunction(MFunction mfunc) {
+ if (mfunc == null) {
+ return null;
+ }
+
+ Function func = new Function(mfunc.getFunctionName(),
+ mfunc.getDatabase().getName(),
+ mfunc.getClassName(),
+ mfunc.getOwnerName(),
+ PrincipalType.valueOf(mfunc.getOwnerType()),
+ mfunc.getCreateTime(),
+ FunctionType.findByValue(mfunc.getFunctionType()));
+ return func;
+ }
+
+ private MFunction convertToMFunction(Function func) throws InvalidObjectException {
+ if (func == null) {
+ return null;
+ }
+
+ MDatabase mdb = null;
+ try {
+ mdb = getMDatabase(func.getDbName());
+ } catch (NoSuchObjectException e) {
+ LOG.error(StringUtils.stringifyException(e));
+ throw new InvalidObjectException("Database " + func.getDbName() + " doesn't exist.");
+ }
+
+ MFunction mfunc = new MFunction(func.getFunctionName(),
+ mdb,
+ func.getClassName(),
+ func.getOwnerName(),
+ func.getOwnerType().name(),
+ func.getCreateTime(),
+ func.getFunctionType().getValue());
+ return mfunc;
+ }
+
+ public void createFunction(Function func) throws InvalidObjectException, MetaException {
+ boolean committed = false;
+ try {
+ openTransaction();
+ MFunction mfunc = convertToMFunction(func);
+ pm.makePersistent(mfunc);
+ committed = commitTransaction();
+ } finally {
+ if (!committed) {
+ rollbackTransaction();
+ }
+ }
+ }
+
+ public void alterFunction(String dbName, String funcName, Function newFunction)
+ throws InvalidObjectException, MetaException {
+ boolean success = false;
+ try {
+ openTransaction();
+ funcName = funcName.toLowerCase();
+ dbName = dbName.toLowerCase();
+ MFunction newf = convertToMFunction(newFunction);
+ if (newf == null) {
+ throw new InvalidObjectException("new function is invalid");
+ }
+
+ MFunction oldf = getMFunction(dbName, funcName);
+ if (oldf == null) {
+ throw new MetaException("function " + funcName + " doesn't exist");
+ }
+
+ // For now only alter name, owner, class name, type
+ oldf.setFunctionName(newf.getFunctionName().toLowerCase());
+ oldf.setDatabase(newf.getDatabase());
+ oldf.setOwnerName(newf.getOwnerName());
+ oldf.setOwnerType(newf.getOwnerType());
+ oldf.setClassName(newf.getClassName());
+ oldf.setFunctionType(newf.getFunctionType());
+
+ // commit the changes
+ success = commitTransaction();
+ } finally {
+ if (!success) {
+ rollbackTransaction();
+ }
+ }
+ }
+
+ public void dropFunction(String dbName, String funcName) throws MetaException,
+ NoSuchObjectException, InvalidObjectException, InvalidInputException {
+ boolean success = false;
+ try {
+ openTransaction();
+ MFunction mfunc = getMFunction(dbName, funcName);
+ pm.retrieve(mfunc);
+ if (mfunc != null) {
+ // TODO: When function privileges are implemented, they should be deleted here.
+ pm.deletePersistentAll(mfunc);
+ }
+ success = commitTransaction();
+ } finally {
+ if (!success) {
+ rollbackTransaction();
+ }
+ }
+ }
+
+ private MFunction getMFunction(String db, String function) {
+ MFunction mfunc = null;
+ boolean commited = false;
+ try {
+ openTransaction();
+ db = db.toLowerCase().trim();
+ function = function.toLowerCase().trim();
+ Query query = pm.newQuery(MFunction.class, "functionName == function && database.name == db");
+ query.declareParameters("java.lang.String function, java.lang.String db");
+ query.setUnique(true);
+ mfunc = (MFunction) query.execute(function, db);
+ pm.retrieve(mfunc);
+ commited = commitTransaction();
+ } finally {
+ if (!commited) {
+ rollbackTransaction();
+ }
+ }
+ return mfunc;
+ }
+
+ public Function getFunction(String dbName, String funcName) throws MetaException {
+ boolean commited = false;
+ Function func = null;
+ try {
+ openTransaction();
+ func = convertToFunction(getMFunction(dbName, funcName));
+ commited = commitTransaction();
+ } finally {
+ if (!commited) {
+ rollbackTransaction();
+ }
+ }
+ return func;
+ }
+
+ public List<String> getFunctions(String dbName, String pattern)
+ throws MetaException {
+ boolean commited = false;
+ List<String> funcs = null;
+ try {
+ openTransaction();
+ dbName = dbName.toLowerCase().trim();
+ // Take the pattern and split it on the | to get all the composing
+ // patterns
+ String[] subpatterns = pattern.trim().split("\\|");
+ String query =
+ "select functionName from org.apache.hadoop.hive.metastore.model.MFunction "
+ + "where database.name == dbName && (";
+ boolean first = true;
+ for (String subpattern : subpatterns) {
+ subpattern = "(?i)" + subpattern.replaceAll("\\*", ".*");
+ if (!first) {
+ query = query + " || ";
+ }
+ query = query + " functionName.matches(\"" + subpattern + "\")";
+ first = false;
+ }
+ query = query + ")";
+
+ Query q = pm.newQuery(query);
+ q.declareParameters("java.lang.String dbName");
+ q.setResult("functionName");
+ q.setOrdering("functionName ascending");
+ Collection names = (Collection) q.execute(dbName);
+ funcs = new ArrayList<String>();
+ for (Iterator i = names.iterator(); i.hasNext();) {
+ funcs.add((String) i.next());
+ }
+ commited = commitTransaction();
+ } finally {
+ if (!commited) {
+ rollbackTransaction();
+ }
+ }
+ return funcs;
+ }
+
}
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java?rev=1569985&r1=1569984&r2=1569985&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java Wed Feb 19 23:50:32 2014
@@ -29,6 +29,7 @@ import java.util.Set;
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.hive.metastore.api.ColumnStatistics;
import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.Function;
import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
import org.apache.hadoop.hive.metastore.api.Index;
import org.apache.hadoop.hive.metastore.api.InvalidInputException;
@@ -486,4 +487,56 @@ public interface RawStore extends Config
List<HiveObjectPrivilege> listTableColumnGrantsAll(
String dbName, String tableName, String columnName);
+
+ /**
+ * Register a user-defined function based on the function specification passed in.
+ * @param func
+ * @throws InvalidObjectException
+ * @throws MetaException
+ */
+ public void createFunction(Function func)
+ throws InvalidObjectException, MetaException;
+
+ /**
+ * Alter function based on new function specs.
+ * @param dbName
+ * @param name
+ * @param newFunction
+ * @throws InvalidObjectException
+ * @throws MetaException
+ */
+ public void alterFunction(String dbName, String funcName, Function newFunction)
+ throws InvalidObjectException, MetaException;
+
+ /**
+ * Drop a function definition.
+ * @param dbName
+ * @param functionName
+ * @return
+ * @throws MetaException
+ * @throws NoSuchObjectException
+ * @throws InvalidObjectException
+ * @throws InvalidInputException
+ */
+ public void dropFunction(String dbName, String funcName)
+ throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException;
+
+ /**
+ * Retrieve function by name.
+ * @param dbName
+ * @param functionName
+ * @return
+ * @throws MetaException
+ */
+ public Function getFunction(String dbName, String funcName) throws MetaException;
+
+ /**
+ * Retrieve list of function names based on name pattern.
+ * @param dbName
+ * @param pattern
+ * @return
+ * @throws MetaException
+ */
+ public List<String> getFunctions(String dbName, String pattern) throws MetaException;
+
}