You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2014/08/15 17:38:13 UTC
svn commit: r1618215 [4/25] - in /hive/branches/spark: ./ bin/
common/src/java/org/apache/hadoop/hive/conf/
contrib/src/test/results/clientnegative/
contrib/src/test/results/clientpositive/
hbase-handler/src/test/results/negative/ hbase-handler/src/tes...
Modified: hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote (original)
+++ hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote Fri Aug 15 15:37:46 2014
@@ -23,6 +23,8 @@ if len(sys.argv) <= 1 or sys.argv[1] ==
print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
print ''
print 'Functions:'
+ print ' string getMetaConf(string key)'
+ print ' void setMetaConf(string key, string value)'
print ' void create_database(Database database)'
print ' Database get_database(string name)'
print ' void drop_database(string name, bool deleteData, bool cascade)'
@@ -184,7 +186,19 @@ protocol = TBinaryProtocol.TBinaryProtoc
client = ThriftHiveMetastore.Client(protocol)
transport.open()
-if cmd == 'create_database':
+if cmd == 'getMetaConf':
+ if len(args) != 1:
+ print 'getMetaConf requires 1 args'
+ sys.exit(1)
+ pp.pprint(client.getMetaConf(args[0],))
+
+elif cmd == 'setMetaConf':
+ if len(args) != 2:
+ print 'setMetaConf requires 2 args'
+ sys.exit(1)
+ pp.pprint(client.setMetaConf(args[0],args[1],))
+
+elif cmd == 'create_database':
if len(args) != 1:
print 'create_database requires 1 args'
sys.exit(1)
Modified: hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py (original)
+++ hive/branches/spark/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py Fri Aug 15 15:37:46 2014
@@ -22,6 +22,21 @@ class Iface(fb303.FacebookService.Iface)
"""
This interface is live.
"""
+ def getMetaConf(self, key):
+ """
+ Parameters:
+ - key
+ """
+ pass
+
+ def setMetaConf(self, key, value):
+ """
+ Parameters:
+ - key
+ - value
+ """
+ pass
+
def create_database(self, database):
"""
Parameters:
@@ -926,6 +941,70 @@ class Client(fb303.FacebookService.Clien
def __init__(self, iprot, oprot=None):
fb303.FacebookService.Client.__init__(self, iprot, oprot)
+ def getMetaConf(self, key):
+ """
+ Parameters:
+ - key
+ """
+ self.send_getMetaConf(key)
+ return self.recv_getMetaConf()
+
+ def send_getMetaConf(self, key):
+ self._oprot.writeMessageBegin('getMetaConf', TMessageType.CALL, self._seqid)
+ args = getMetaConf_args()
+ args.key = key
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getMetaConf(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getMetaConf_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, "getMetaConf failed: unknown result");
+
+ def setMetaConf(self, key, value):
+ """
+ Parameters:
+ - key
+ - value
+ """
+ self.send_setMetaConf(key, value)
+ self.recv_setMetaConf()
+
+ def send_setMetaConf(self, key, value):
+ self._oprot.writeMessageBegin('setMetaConf', TMessageType.CALL, self._seqid)
+ args = setMetaConf_args()
+ args.key = key
+ args.value = value
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_setMetaConf(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = setMetaConf_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.o1 is not None:
+ raise result.o1
+ return
+
def create_database(self, database):
"""
Parameters:
@@ -4888,6 +4967,8 @@ class Client(fb303.FacebookService.Clien
class Processor(fb303.FacebookService.Processor, Iface, TProcessor):
def __init__(self, handler):
fb303.FacebookService.Processor.__init__(self, handler)
+ self._processMap["getMetaConf"] = Processor.process_getMetaConf
+ self._processMap["setMetaConf"] = Processor.process_setMetaConf
self._processMap["create_database"] = Processor.process_create_database
self._processMap["get_database"] = Processor.process_get_database
self._processMap["drop_database"] = Processor.process_drop_database
@@ -5014,6 +5095,34 @@ class Processor(fb303.FacebookService.Pr
self._processMap[name](self, seqid, iprot, oprot)
return True
+ def process_getMetaConf(self, seqid, iprot, oprot):
+ args = getMetaConf_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getMetaConf_result()
+ try:
+ result.success = self._handler.getMetaConf(args.key)
+ except MetaException as o1:
+ result.o1 = o1
+ oprot.writeMessageBegin("getMetaConf", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_setMetaConf(self, seqid, iprot, oprot):
+ args = setMetaConf_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = setMetaConf_result()
+ try:
+ self._handler.setMetaConf(args.key, args.value)
+ except MetaException as o1:
+ result.o1 = o1
+ oprot.writeMessageBegin("setMetaConf", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
def process_create_database(self, seqid, iprot, oprot):
args = create_database_args()
args.read(iprot)
@@ -6772,6 +6881,271 @@ class Processor(fb303.FacebookService.Pr
# HELPER FUNCTIONS AND STRUCTURES
+class getMetaConf_args:
+ """
+ Attributes:
+ - key
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'key', None, None, ), # 1
+ )
+
+ def __init__(self, key=None,):
+ self.key = key
+
+ 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.key = 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('getMetaConf_args')
+ if self.key is not None:
+ oprot.writeFieldBegin('key', TType.STRING, 1)
+ oprot.writeString(self.key)
+ 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 getMetaConf_result:
+ """
+ Attributes:
+ - success
+ - o1
+ """
+
+ thrift_spec = (
+ (0, TType.STRING, '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.STRING:
+ self.success = iprot.readString();
+ 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('getMetaConf_result')
+ if self.success is not None:
+ oprot.writeFieldBegin('success', TType.STRING, 0)
+ oprot.writeString(self.success)
+ 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 setMetaConf_args:
+ """
+ Attributes:
+ - key
+ - value
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'key', None, None, ), # 1
+ (2, TType.STRING, 'value', None, None, ), # 2
+ )
+
+ def __init__(self, key=None, value=None,):
+ self.key = key
+ self.value = value
+
+ 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.key = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.value = 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('setMetaConf_args')
+ if self.key is not None:
+ oprot.writeFieldBegin('key', TType.STRING, 1)
+ oprot.writeString(self.key)
+ oprot.writeFieldEnd()
+ if self.value is not None:
+ oprot.writeFieldBegin('value', TType.STRING, 2)
+ oprot.writeString(self.value)
+ 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 setMetaConf_result:
+ """
+ Attributes:
+ - o1
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, o1=None,):
+ 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 == 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('setMetaConf_result')
+ 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 create_database_args:
"""
Attributes:
Modified: hive/branches/spark/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb (original)
+++ hive/branches/spark/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb Fri Aug 15 15:37:46 2014
@@ -12,6 +12,37 @@ module ThriftHiveMetastore
class Client < ::FacebookService::Client
include ::Thrift::Client
+ def getMetaConf(key)
+ send_getMetaConf(key)
+ return recv_getMetaConf()
+ end
+
+ def send_getMetaConf(key)
+ send_message('getMetaConf', GetMetaConf_args, :key => key)
+ end
+
+ def recv_getMetaConf()
+ result = receive_message(GetMetaConf_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getMetaConf failed: unknown result')
+ end
+
+ def setMetaConf(key, value)
+ send_setMetaConf(key, value)
+ recv_setMetaConf()
+ end
+
+ def send_setMetaConf(key, value)
+ send_message('setMetaConf', SetMetaConf_args, :key => key, :value => value)
+ end
+
+ def recv_setMetaConf()
+ result = receive_message(SetMetaConf_result)
+ raise result.o1 unless result.o1.nil?
+ return
+ end
+
def create_database(database)
send_create_database(database)
recv_create_database()
@@ -1864,6 +1895,28 @@ module ThriftHiveMetastore
class Processor < ::FacebookService::Processor
include ::Thrift::Processor
+ def process_getMetaConf(seqid, iprot, oprot)
+ args = read_args(iprot, GetMetaConf_args)
+ result = GetMetaConf_result.new()
+ begin
+ result.success = @handler.getMetaConf(args.key)
+ rescue ::MetaException => o1
+ result.o1 = o1
+ end
+ write_result(result, oprot, 'getMetaConf', seqid)
+ end
+
+ def process_setMetaConf(seqid, iprot, oprot)
+ args = read_args(iprot, SetMetaConf_args)
+ result = SetMetaConf_result.new()
+ begin
+ @handler.setMetaConf(args.key, args.value)
+ rescue ::MetaException => o1
+ result.o1 = o1
+ end
+ write_result(result, oprot, 'setMetaConf', seqid)
+ end
+
def process_create_database(seqid, iprot, oprot)
args = read_args(iprot, Create_database_args)
result = Create_database_result.new()
@@ -3286,6 +3339,74 @@ module ThriftHiveMetastore
# HELPER FUNCTIONS AND STRUCTURES
+ class GetMetaConf_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ KEY = 1
+
+ FIELDS = {
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key'}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class GetMetaConf_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class SetMetaConf_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ KEY = 1
+ VALUE = 2
+
+ FIELDS = {
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class SetMetaConf_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ O1 = 1
+
+ FIELDS = {
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
class Create_database_args
include ::Thrift::Struct, ::Thrift::Struct_Union
DATABASE = 1
Modified: hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Fri Aug 15 15:37:46 2014
@@ -142,6 +142,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
+import org.apache.hadoop.hive.metastore.events.ConfigChangeEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
@@ -348,15 +349,19 @@ public class HiveMetaStore extends Thrif
}
public HMSHandler(String name) throws MetaException {
- super(name);
- hiveConf = new HiveConf(this.getClass());
- init();
+ this(name, new HiveConf(HMSHandler.class), true);
}
public HMSHandler(String name, HiveConf conf) throws MetaException {
+ this(name, conf, true);
+ }
+
+ public HMSHandler(String name, HiveConf conf, boolean init) throws MetaException {
super(name);
hiveConf = conf;
- init();
+ if (init) {
+ init();
+ }
}
public HiveConf getHiveConf() {
@@ -378,7 +383,7 @@ public class HiveMetaStore extends Thrif
}
}
- private boolean init() throws MetaException {
+ public void init() throws MetaException {
rawStoreClassName = hiveConf.getVar(HiveConf.ConfVars.METASTORE_RAW_STORE_IMPL);
initListeners = MetaStoreUtils.getMetaStoreListeners(
MetaStoreInitListener.class, hiveConf,
@@ -436,7 +441,6 @@ public class HiveMetaStore extends Thrif
Timer cleaner = new Timer("Metastore Events Cleaner Thread", true);
cleaner.schedule(new EventCleanerTask(this), cleanFreq, cleanFreq);
}
- return true;
}
private String addPrefix(String s) {
@@ -448,10 +452,11 @@ public class HiveMetaStore extends Thrif
threadLocalConf.set(conf);
RawStore ms = threadLocalMS.get();
if (ms != null) {
- ms.setConf(conf);
+ ms.setConf(conf); // reload if DS related configuration is changed
}
}
+ @Override
public Configuration getConf() {
Configuration conf = threadLocalConf.get();
if (conf == null) {
@@ -465,6 +470,35 @@ public class HiveMetaStore extends Thrif
return wh;
}
+ @Override
+ public void setMetaConf(String key, String value) throws MetaException {
+ ConfVars confVar = HiveConf.getMetaConf(key);
+ if (confVar == null) {
+ throw new MetaException("Invalid configuration key " + key);
+ }
+ String validate = confVar.validate(value);
+ if (validate != null) {
+ throw new MetaException("Invalid configuration value " + value + " for key " + key +
+ " by " + validate);
+ }
+ Configuration configuration = getConf();
+ String oldValue = configuration.get(key);
+ configuration.set(key, value);
+
+ for (MetaStoreEventListener listener : listeners) {
+ listener.onConfigChange(new ConfigChangeEvent(this, key, oldValue, value));
+ }
+ }
+
+ @Override
+ public String getMetaConf(String key) throws MetaException {
+ ConfVars confVar = HiveConf.getMetaConf(key);
+ if (confVar == null) {
+ throw new MetaException("Invalid configuration key " + key);
+ }
+ return getConf().get(key);
+ }
+
/**
* Get a cached RawStore.
*
@@ -676,8 +710,11 @@ public class HiveMetaStore extends Thrif
logInfo("Shutting down the object store...");
RawStore ms = threadLocalMS.get();
if (ms != null) {
- ms.shutdown();
- threadLocalMS.remove();
+ try {
+ ms.shutdown();
+ } finally {
+ threadLocalMS.remove();
+ }
}
logInfo("Metastore shutdown complete.");
}
@@ -5002,9 +5039,13 @@ public class HiveMetaStore extends Thrif
}
public static IHMSHandler newHMSHandler(String name, HiveConf hiveConf) throws MetaException {
- return RetryingHMSHandler.getProxy(hiveConf, name);
+ return newHMSHandler(name, hiveConf, false);
}
+ public static IHMSHandler newHMSHandler(String name, HiveConf hiveConf, boolean local)
+ throws MetaException {
+ return RetryingHMSHandler.getProxy(hiveConf, name, local);
+ }
/**
* Discard a current delegation token.
Modified: hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java (original)
+++ hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java Fri Aug 15 15:37:46 2014
@@ -173,7 +173,7 @@ public class HiveMetaStoreClient impleme
if (localMetaStore) {
// instantiate the metastore server handler directly instead of connecting
// through the network
- client = HiveMetaStore.newHMSHandler("hive client", conf);
+ client = HiveMetaStore.newHMSHandler("hive client", conf, true);
isConnected = true;
snapshotActiveConf();
return;
@@ -443,6 +443,16 @@ public class HiveMetaStoreClient impleme
}
}
+ @Override
+ public void setMetaConf(String key, String value) throws TException {
+ client.setMetaConf(key, value);
+ }
+
+ @Override
+ public String getMetaConf(String key) throws TException {
+ return client.getMetaConf(key);
+ }
+
/**
* @param new_part
* @return the added partition
Modified: hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java (original)
+++ hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java Fri Aug 15 15:37:46 2014
@@ -18,10 +18,11 @@
package org.apache.hadoop.hive.metastore;
-import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore;
-public interface IHMSHandler extends ThriftHiveMetastore.Iface {
+public interface IHMSHandler extends ThriftHiveMetastore.Iface, Configurable {
- public abstract void setConf(Configuration conf);
+ void init() throws MetaException;
}
Modified: hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java (original)
+++ hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java Fri Aug 15 15:37:46 2014
@@ -77,17 +77,30 @@ import org.apache.hadoop.hive.metastore.
public interface IMetaStoreClient {
/**
- * Returns whether current client is convertible with conf or not
+ * Returns whether current client is compatible with conf argument or not
* @return
*/
- public boolean isCompatibleWith(HiveConf conf);
+ boolean isCompatibleWith(HiveConf conf);
/**
* Tries to reconnect this MetaStoreClient to the MetaStore.
*/
- public void reconnect() throws MetaException;
+ void reconnect() throws MetaException;
- public void close();
+ /**
+ * close connection to meta store
+ */
+ void close();
+
+ /**
+ * set meta variable which is open to end users
+ */
+ void setMetaConf(String key, String value) throws MetaException, TException;
+
+ /**
+ * get current meta variable
+ */
+ String getMetaConf(String key) throws MetaException, TException;
/**
* Get the names of all databases in the MetaStore that match the given pattern.
@@ -96,8 +109,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<String> getDatabases(String databasePattern)
- throws MetaException, TException;
+ List<String> getDatabases(String databasePattern) throws MetaException, TException;
/**
* Get the names of all databases in the MetaStore.
@@ -105,8 +117,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<String> getAllDatabases()
- throws MetaException, TException;
+ List<String> getAllDatabases() throws MetaException, TException;
/**
* Get the names of all tables in the specified database that satisfy the supplied
@@ -118,7 +129,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws UnknownDBException
*/
- public List<String> getTables(String dbName, String tablePattern)
+ List<String> getTables(String dbName, String tablePattern)
throws MetaException, TException, UnknownDBException;
/**
@@ -129,8 +140,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws UnknownDBException
*/
- public List<String> getAllTables(String dbName)
- throws MetaException, TException, UnknownDBException;
+ List<String> getAllTables(String dbName) throws MetaException, TException, UnknownDBException;
/**
* Get a list of table names that match a filter.
@@ -168,7 +178,7 @@ public interface IMetaStoreClient {
* The maximum number of tables returned
* @return A list of table names that match the desired filter
*/
- public List<String> listTableNamesByFilter(String dbName, String filter, short maxTables)
+ List<String> listTableNamesByFilter(String dbName, String filter, short maxTables)
throws MetaException, TException, InvalidOperationException, UnknownDBException;
@@ -186,7 +196,7 @@ public interface IMetaStoreClient {
* @throws TException
* A thrift communication error occurred
*/
- public void dropTable(String dbname, String tableName, boolean deleteData,
+ void dropTable(String dbname, String tableName, boolean deleteData,
boolean ignoreUknownTab) throws MetaException, TException,
NoSuchObjectException;
@@ -210,14 +220,13 @@ public interface IMetaStoreClient {
* This method will be removed in release 0.7.0.
*/
@Deprecated
- public void dropTable(String tableName, boolean deleteData)
- throws MetaException, UnknownTableException, TException,
- NoSuchObjectException;
+ void dropTable(String tableName, boolean deleteData)
+ throws MetaException, UnknownTableException, TException, NoSuchObjectException;
- public void dropTable(String dbname, String tableName)
+ void dropTable(String dbname, String tableName)
throws MetaException, TException, NoSuchObjectException;
- public boolean tableExists(String databaseName, String tableName) throws MetaException,
+ boolean tableExists(String databaseName, String tableName) throws MetaException,
TException, UnknownDBException;
/**
@@ -231,7 +240,7 @@ public interface IMetaStoreClient {
* This method will be removed in release 0.7.0.
*/
@Deprecated
- public boolean tableExists(String tableName) throws MetaException,
+ boolean tableExists(String tableName) throws MetaException,
TException, UnknownDBException;
/**
@@ -250,8 +259,7 @@ public interface IMetaStoreClient {
* This method will be removed in release 0.7.0.
*/
@Deprecated
- public Table getTable(String tableName) throws MetaException, TException,
- NoSuchObjectException;
+ Table getTable(String tableName) throws MetaException, TException, NoSuchObjectException;
/**
* Get a Database Object
@@ -261,8 +269,8 @@ public interface IMetaStoreClient {
* @throws MetaException Could not fetch the database
* @throws TException A thrift communication error occurred
*/
- public Database getDatabase(String databaseName)
- throws NoSuchObjectException, MetaException, TException;
+ Database getDatabase(String databaseName)
+ throws NoSuchObjectException, MetaException, TException;
/**
@@ -280,7 +288,7 @@ public interface IMetaStoreClient {
* @throws NoSuchObjectException
* In case the table wasn't found.
*/
- public Table getTable(String dbName, String tableName) throws MetaException,
+ Table getTable(String dbName, String tableName) throws MetaException,
TException, NoSuchObjectException;
/**
@@ -302,7 +310,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* Any other errors
*/
- public List<Table> getTableObjectsByName(String dbName, List<String> tableNames)
+ List<Table> getTableObjectsByName(String dbName, List<String> tableNames)
throws MetaException, InvalidOperationException, UnknownDBException, TException;
/**
@@ -317,11 +325,11 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#append_partition(java.lang.String,
* java.lang.String, java.util.List)
*/
- public Partition appendPartition(String tableName, String dbName,
+ Partition appendPartition(String tableName, String dbName,
List<String> partVals) throws InvalidObjectException,
AlreadyExistsException, MetaException, TException;
- public Partition appendPartition(String tableName, String dbName, String name)
+ Partition appendPartition(String tableName, String dbName, String name)
throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
/**
@@ -339,9 +347,8 @@ public interface IMetaStoreClient {
* @throws TException
* Thrift exception
*/
- public Partition add_partition(Partition partition)
- throws InvalidObjectException, AlreadyExistsException, MetaException,
- TException;
+ Partition add_partition(Partition partition)
+ throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
/**
* Add partitions to the table.
@@ -357,7 +364,7 @@ public interface IMetaStoreClient {
* @throws TException
* Thrift exception
*/
- public int add_partitions(List<Partition> partitions)
+ int add_partitions(List<Partition> partitions)
throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
/**
@@ -368,7 +375,7 @@ public interface IMetaStoreClient {
* @param needResults Whether the results are needed
* @return the partitions that were added, or null if !needResults
*/
- public List<Partition> add_partitions(
+ List<Partition> add_partitions(
List<Partition> partitions, boolean ifNotExists, boolean needResults)
throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
@@ -382,7 +389,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_partition(java.lang.String,
* java.lang.String, java.util.List)
*/
- public Partition getPartition(String tblName, String dbName,
+ Partition getPartition(String tblName, String dbName,
List<String> partVals) throws NoSuchObjectException, MetaException, TException;
/**
@@ -393,7 +400,7 @@ public interface IMetaStoreClient {
* @param destTableName
* @return partition object
*/
- public Partition exchange_partition(Map<String, String> partitionSpecs,
+ Partition exchange_partition(Map<String, String> partitionSpecs,
String sourceDb, String sourceTable, String destdb,
String destTableName) throws MetaException, NoSuchObjectException,
InvalidObjectException, TException;
@@ -408,7 +415,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_partition(java.lang.String,
* java.lang.String, java.util.List)
*/
- public Partition getPartition(String dbName, String tblName,
+ Partition getPartition(String dbName, String tblName,
String name) throws MetaException, UnknownTableException, NoSuchObjectException, TException;
@@ -424,7 +431,7 @@ public interface IMetaStoreClient {
* @throws NoSuchObjectException
* @throws TException
*/
- public Partition getPartitionWithAuthInfo(String dbName, String tableName,
+ Partition getPartitionWithAuthInfo(String dbName, String tableName,
List<String> pvals, String userName, List<String> groupNames)
throws MetaException, UnknownTableException, NoSuchObjectException, TException;
@@ -437,16 +444,16 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<Partition> listPartitions(String db_name, String tbl_name,
+ List<Partition> listPartitions(String db_name, String tbl_name,
short max_parts) throws NoSuchObjectException, MetaException, TException;
- public List<Partition> listPartitions(String db_name, String tbl_name,
+ List<Partition> listPartitions(String db_name, String tbl_name,
List<String> part_vals, short max_parts) throws NoSuchObjectException, MetaException, TException;
- public List<String> listPartitionNames(String db_name, String tbl_name,
+ List<String> listPartitionNames(String db_name, String tbl_name,
short max_parts) throws MetaException, TException;
- public List<String> listPartitionNames(String db_name, String tbl_name,
+ List<String> listPartitionNames(String db_name, String tbl_name,
List<String> part_vals, short max_parts)
throws MetaException, TException, NoSuchObjectException;
@@ -464,7 +471,7 @@ public interface IMetaStoreClient {
* @throws NoSuchObjectException
* @throws TException
*/
- public List<Partition> listPartitionsByFilter(String db_name, String tbl_name,
+ List<Partition> listPartitionsByFilter(String db_name, String tbl_name,
String filter, short max_parts) throws MetaException,
NoSuchObjectException, TException;
@@ -481,7 +488,7 @@ public interface IMetaStoreClient {
* @param result the resulting list of partitions
* @return whether the resulting list contains partitions which may or may not match the expr
*/
- public boolean listPartitionsByExpr(String db_name, String tbl_name,
+ boolean listPartitionsByExpr(String db_name, String tbl_name,
byte[] expr, String default_partition_name, short max_parts, List<Partition> result)
throws TException;
@@ -494,7 +501,7 @@ public interface IMetaStoreClient {
* @return the list of partitions
* @throws NoSuchObjectException
*/
- public List<Partition> listPartitionsWithAuthInfo(String dbName,
+ List<Partition> listPartitionsWithAuthInfo(String dbName,
String tableName, short s, String userName, List<String> groupNames)
throws MetaException, TException, NoSuchObjectException;
@@ -508,7 +515,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<Partition> getPartitionsByNames(String db_name, String tbl_name,
+ List<Partition> getPartitionsByNames(String db_name, String tbl_name,
List<String> part_names) throws NoSuchObjectException, MetaException, TException;
/**
@@ -521,7 +528,7 @@ public interface IMetaStoreClient {
* @return the list of paritions
* @throws NoSuchObjectException
*/
- public List<Partition> listPartitionsWithAuthInfo(String dbName,
+ List<Partition> listPartitionsWithAuthInfo(String dbName,
String tableName, List<String> partialPvals, short s, String userName,
List<String> groupNames) throws MetaException, TException, NoSuchObjectException;
@@ -538,7 +545,7 @@ public interface IMetaStoreClient {
* @throws UnknownPartitionException
* @throws InvalidPartitionException
*/
- public void markPartitionForEvent(String db_name, String tbl_name, Map<String,String> partKVs,
+ void markPartitionForEvent(String db_name, String tbl_name, Map<String,String> partKVs,
PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException,
UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException;
@@ -555,7 +562,7 @@ public interface IMetaStoreClient {
* @throws UnknownPartitionException
* @throws InvalidPartitionException
*/
- public boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map<String,String> partKVs,
+ boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map<String,String> partKVs,
PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException,
UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException;
@@ -564,9 +571,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws MetaException
*/
- public void validatePartitionNameCharacters(List<String> partVals)
- throws TException, MetaException;
-
+ void validatePartitionNameCharacters(List<String> partVals) throws TException, MetaException;
/**
* @param tbl
@@ -578,25 +583,25 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#create_table(org.apache.hadoop.hive.metastore.api.Table)
*/
- public void createTable(Table tbl) throws AlreadyExistsException,
+ void createTable(Table tbl) throws AlreadyExistsException,
InvalidObjectException, MetaException, NoSuchObjectException, TException;
- public void alter_table(String defaultDatabaseName, String tblName,
+ void alter_table(String defaultDatabaseName, String tblName,
Table table) throws InvalidOperationException, MetaException, TException;
- public void createDatabase(Database db)
+ void createDatabase(Database db)
throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
- public void dropDatabase(String name)
+ void dropDatabase(String name)
throws NoSuchObjectException, InvalidOperationException, MetaException, TException;
- public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb)
+ void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb)
throws NoSuchObjectException, InvalidOperationException, MetaException, TException;
- public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade)
+ void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade)
throws NoSuchObjectException, InvalidOperationException, MetaException, TException;
- public void alterDatabase(String name, Database db)
+ void alterDatabase(String name, Database db)
throws NoSuchObjectException, MetaException, TException;
/**
@@ -612,7 +617,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#drop_partition(java.lang.String,
* java.lang.String, java.util.List, boolean)
*/
- public boolean dropPartition(String db_name, String tbl_name,
+ boolean dropPartition(String db_name, String tbl_name,
List<String> part_vals, boolean deleteData) throws NoSuchObjectException,
MetaException, TException;
@@ -620,7 +625,7 @@ public interface IMetaStoreClient {
List<ObjectPair<Integer, byte[]>> partExprs, boolean deleteData, boolean ignoreProtection,
boolean ifExists) throws NoSuchObjectException, MetaException, TException;
- public boolean dropPartition(String db_name, String tbl_name,
+ boolean dropPartition(String db_name, String tbl_name,
String name, boolean deleteData) throws NoSuchObjectException,
MetaException, TException;
/**
@@ -639,7 +644,7 @@ public interface IMetaStoreClient {
* @throws TException
* if error in communicating with metastore server
*/
- public void alter_partition(String dbName, String tblName, Partition newPart)
+ void alter_partition(String dbName, String tblName, Partition newPart)
throws InvalidOperationException, MetaException, TException;
/**
@@ -658,7 +663,7 @@ public interface IMetaStoreClient {
* @throws TException
* if error in communicating with metastore server
*/
- public void alter_partitions(String dbName, String tblName, List<Partition> newParts)
+ void alter_partitions(String dbName, String tblName, List<Partition> newParts)
throws InvalidOperationException, MetaException, TException;
/**
@@ -679,7 +684,7 @@ public interface IMetaStoreClient {
* @throws TException
* if error in communicating with metastore server
*/
- public void renamePartition(final String dbname, final String name, final List<String> part_vals, final Partition newPart)
+ void renamePartition(final String dbname, final String name, final List<String> part_vals, final Partition newPart)
throws InvalidOperationException, MetaException, TException;
/**
@@ -692,7 +697,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_fields(java.lang.String,
* java.lang.String)
*/
- public List<FieldSchema> getFields(String db, String tableName)
+ List<FieldSchema> getFields(String db, String tableName)
throws MetaException, TException, UnknownTableException,
UnknownDBException;
@@ -706,7 +711,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_schema(java.lang.String,
* java.lang.String)
*/
- public List<FieldSchema> getSchema(String db, String tableName)
+ List<FieldSchema> getSchema(String db, String tableName)
throws MetaException, TException, UnknownTableException,
UnknownDBException;
@@ -719,7 +724,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws ConfigValSecurityException
*/
- public String getConfigValue(String name, String defaultValue)
+ String getConfigValue(String name, String defaultValue)
throws TException, ConfigValSecurityException;
/**
@@ -730,7 +735,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<String> partitionNameToVals(String name)
+ List<String> partitionNameToVals(String name)
throws MetaException, TException;
/**
*
@@ -740,7 +745,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public Map<String, String> partitionNameToSpec(String name)
+ Map<String, String> partitionNameToSpec(String name)
throws MetaException, TException;
/**
@@ -752,10 +757,10 @@ public interface IMetaStoreClient {
* @throws TException
* @throws AlreadyExistsException
*/
- public void createIndex(Index index, Table indexTable) throws InvalidObjectException,
+ void createIndex(Index index, Table indexTable) throws InvalidObjectException,
MetaException, NoSuchObjectException, TException, AlreadyExistsException;
- public void alter_index(String dbName, String tblName, String indexName,
+ void alter_index(String dbName, String tblName, String indexName,
Index index) throws InvalidOperationException, MetaException, TException;
/**
@@ -769,7 +774,7 @@ public interface IMetaStoreClient {
* @throws NoSuchObjectException
* @throws TException
*/
- public Index getIndex(String dbName, String tblName, String indexName)
+ Index getIndex(String dbName, String tblName, String indexName)
throws MetaException, UnknownTableException, NoSuchObjectException,
TException;
@@ -784,7 +789,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<Index> listIndexes(String db_name, String tbl_name,
+ List<Index> listIndexes(String db_name, String tbl_name,
short max) throws NoSuchObjectException, MetaException, TException;
/**
@@ -797,7 +802,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<String> listIndexNames(String db_name, String tbl_name,
+ List<String> listIndexNames(String db_name, String tbl_name,
short max) throws MetaException, TException;
/**
@@ -810,7 +815,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean dropIndex(String db_name, String tbl_name,
+ boolean dropIndex(String db_name, String tbl_name,
String name, boolean deleteData) throws NoSuchObjectException,
MetaException, TException;
@@ -825,7 +830,7 @@ public interface IMetaStoreClient {
* @throws InvalidInputException
*/
- public boolean updateTableColumnStatistics(ColumnStatistics statsObj)
+ boolean updateTableColumnStatistics(ColumnStatistics statsObj)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException,
InvalidInputException;
@@ -840,7 +845,7 @@ public interface IMetaStoreClient {
* @throws InvalidInputException
*/
- public boolean updatePartitionColumnStatistics(ColumnStatistics statsObj)
+ boolean updatePartitionColumnStatistics(ColumnStatistics statsObj)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException,
InvalidInputException;
@@ -848,14 +853,14 @@ public interface IMetaStoreClient {
* Get table column statistics given dbName, tableName and multiple colName-s
* @return ColumnStatistics struct for a given db, table and columns
*/
- public List<ColumnStatisticsObj> getTableColumnStatistics(String dbName, String tableName,
+ List<ColumnStatisticsObj> getTableColumnStatistics(String dbName, String tableName,
List<String> colNames) throws NoSuchObjectException, MetaException, TException;
/**
* Get partitions column statistics given dbName, tableName, multiple partitions and colName-s
* @return ColumnStatistics struct for a given db, table and columns
*/
- public Map<String, List<ColumnStatisticsObj>> getPartitionColumnStatistics(String dbName,
+ Map<String, List<ColumnStatisticsObj>> getPartitionColumnStatistics(String dbName,
String tableName, List<String> partNames, List<String> colNames)
throws NoSuchObjectException, MetaException, TException;
@@ -873,24 +878,23 @@ public interface IMetaStoreClient {
* @throws InvalidInputException
*/
- public boolean deletePartitionColumnStatistics(String dbName, String tableName,
+ boolean deletePartitionColumnStatistics(String dbName, String tableName,
String partName, String colName) throws NoSuchObjectException, MetaException,
InvalidObjectException, TException, InvalidInputException;
- /**
- * Delete table level column statistics given dbName, tableName and colName
- * @param dbName
- * @param tableName
- * @param colName
- * @return boolean indicating the outcome of the operation
- * @throws NoSuchObjectException
- * @throws MetaException
- * @throws InvalidObjectException
- * @throws TException
- * @throws InvalidInputException
- */
-
- public boolean deleteTableColumnStatistics(String dbName, String tableName, String colName) throws
+ /**
+ * Delete table level column statistics given dbName, tableName and colName
+ * @param dbName
+ * @param tableName
+ * @param colName
+ * @return boolean indicating the outcome of the operation
+ * @throws NoSuchObjectException
+ * @throws MetaException
+ * @throws InvalidObjectException
+ * @throws TException
+ * @throws InvalidInputException
+ */
+ boolean deleteTableColumnStatistics(String dbName, String tableName, String colName) throws
NoSuchObjectException, MetaException, InvalidObjectException, TException, InvalidInputException;
/**
@@ -900,7 +904,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean create_role(Role role)
+ boolean create_role(Role role)
throws MetaException, TException;
/**
@@ -911,7 +915,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean drop_role(String role_name) throws MetaException, TException;
+ boolean drop_role(String role_name) throws MetaException, TException;
/**
* list all role names
@@ -919,7 +923,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws MetaException
*/
- public List<String> listRoleNames() throws MetaException, TException;
+ List<String> listRoleNames() throws MetaException, TException;
/**
*
@@ -933,7 +937,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean grant_role(String role_name, String user_name,
+ boolean grant_role(String role_name, String user_name,
PrincipalType principalType, String grantor, PrincipalType grantorType,
boolean grantOption) throws MetaException, TException;
@@ -948,7 +952,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean revoke_role(String role_name, String user_name,
+ boolean revoke_role(String role_name, String user_name,
PrincipalType principalType, boolean grantOption) throws MetaException, TException;
/**
@@ -959,7 +963,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<Role> list_roles(String principalName, PrincipalType principalType)
+ List<Role> list_roles(String principalName, PrincipalType principalType)
throws MetaException, TException;
/**
@@ -972,7 +976,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
+ PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
String user_name, List<String> group_names) throws MetaException,
TException;
@@ -985,7 +989,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<HiveObjectPrivilege> list_privileges(String principal_name,
+ List<HiveObjectPrivilege> list_privileges(String principal_name,
PrincipalType principal_type, HiveObjectRef hiveObject)
throws MetaException, TException;
@@ -995,7 +999,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean grant_privileges(PrivilegeBag privileges)
+ boolean grant_privileges(PrivilegeBag privileges)
throws MetaException, TException;
/**
@@ -1004,7 +1008,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption)
+ boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption)
throws MetaException, TException;
/**
@@ -1014,7 +1018,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public String getDelegationToken(String owner, String renewerKerberosPrincipalName)
+ String getDelegationToken(String owner, String renewerKerberosPrincipalName)
throws MetaException, TException;
/**
@@ -1023,28 +1027,28 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public long renewDelegationToken(String tokenStrForm) throws MetaException, TException;
+ long renewDelegationToken(String tokenStrForm) throws MetaException, TException;
/**
* @param tokenStrForm
* @throws MetaException
* @throws TException
*/
- public void cancelDelegationToken(String tokenStrForm) throws MetaException, TException;
+ void cancelDelegationToken(String tokenStrForm) throws MetaException, TException;
- public void createFunction(Function func)
+ void createFunction(Function func)
throws InvalidObjectException, MetaException, TException;
- public void alterFunction(String dbName, String funcName, Function newFunction)
+ void alterFunction(String dbName, String funcName, Function newFunction)
throws InvalidObjectException, MetaException, TException;
- public void dropFunction(String dbName, String funcName) throws MetaException,
+ void dropFunction(String dbName, String funcName) throws MetaException,
NoSuchObjectException, InvalidObjectException, InvalidInputException, TException;
- public Function getFunction(String dbName, String funcName)
+ Function getFunction(String dbName, String funcName)
throws MetaException, TException;
- public List<String> getFunctions(String dbName, String pattern)
+ List<String> getFunctions(String dbName, String pattern)
throws MetaException, TException;
/**
@@ -1052,7 +1056,7 @@ public interface IMetaStoreClient {
* @return list of valid transactions
* @throws TException
*/
- public ValidTxnList getValidTxns() throws TException;
+ ValidTxnList getValidTxns() throws TException;
/**
* Initiate a transaction.
@@ -1062,7 +1066,7 @@ public interface IMetaStoreClient {
* @return transaction identifier
* @throws TException
*/
- public long openTxn(String user) throws TException;
+ long openTxn(String user) throws TException;
/**
* Initiate a batch of transactions. It is not guaranteed that the
@@ -1089,7 +1093,7 @@ public interface IMetaStoreClient {
* optimistically assuming that the result matches the request.
* @throws TException
*/
- public OpenTxnsResponse openTxns(String user, int numTxns) throws TException;
+ OpenTxnsResponse openTxns(String user, int numTxns) throws TException;
/**
* Rollback a transaction. This will also unlock any locks associated with
@@ -1100,7 +1104,7 @@ public interface IMetaStoreClient {
* deleted.
* @throws TException
*/
- public void rollbackTxn(long txnid) throws NoSuchTxnException, TException;
+ void rollbackTxn(long txnid) throws NoSuchTxnException, TException;
/**
* Commit a transaction. This will also unlock any locks associated with
@@ -1113,7 +1117,7 @@ public interface IMetaStoreClient {
* aborted. This can result from the transaction timing out.
* @throws TException
*/
- public void commitTxn(long txnid)
+ void commitTxn(long txnid)
throws NoSuchTxnException, TxnAbortedException, TException;
/**
@@ -1123,7 +1127,7 @@ public interface IMetaStoreClient {
* @return List of currently opened transactions, included aborted ones.
* @throws TException
*/
- public GetOpenTxnsInfoResponse showTxns() throws TException;
+ GetOpenTxnsInfoResponse showTxns() throws TException;
/**
* Request a set of locks. All locks needed for a particular query, DML,
@@ -1153,7 +1157,7 @@ public interface IMetaStoreClient {
* aborted. This can result from the transaction timing out.
* @throws TException
*/
- public LockResponse lock(LockRequest request)
+ LockResponse lock(LockRequest request)
throws NoSuchTxnException, TxnAbortedException, TException;
/**
@@ -1177,7 +1181,7 @@ public interface IMetaStoreClient {
* This can result from the lock timing out and being unlocked by the system.
* @throws TException
*/
- public LockResponse checkLock(long lockid)
+ LockResponse checkLock(long lockid)
throws NoSuchTxnException, TxnAbortedException, NoSuchLockException,
TException;
@@ -1192,7 +1196,7 @@ public interface IMetaStoreClient {
* transaction.
* @throws TException
*/
- public void unlock(long lockid)
+ void unlock(long lockid)
throws NoSuchLockException, TxnOpenException, TException;
/**
@@ -1200,7 +1204,7 @@ public interface IMetaStoreClient {
* @return List of currently held and waiting locks.
* @throws TException
*/
- public ShowLocksResponse showLocks() throws TException;
+ ShowLocksResponse showLocks() throws TException;
/**
* Send a heartbeat to indicate that the client holding these locks (if
@@ -1222,7 +1226,7 @@ public interface IMetaStoreClient {
* This can result from the lock timing out and being unlocked by the system.
* @throws TException
*/
- public void heartbeat(long txnid, long lockid)
+ void heartbeat(long txnid, long lockid)
throws NoSuchLockException, NoSuchTxnException, TxnAbortedException,
TException;
@@ -1236,7 +1240,7 @@ public interface IMetaStoreClient {
* have already been closed) and which were aborted.
* @throws TException
*/
- public HeartbeatTxnRangeResponse heartbeatTxnRange(long min, long max) throws TException;
+ HeartbeatTxnRangeResponse heartbeatTxnRange(long min, long max) throws TException;
/**
* Send a request to compact a table or partition. This will not block until the compaction is
@@ -1251,7 +1255,7 @@ public interface IMetaStoreClient {
* @param type Whether this is a major or minor compaction.
* @throws TException
*/
- public void compact(String dbname, String tableName, String partitionName, CompactionType type)
+ void compact(String dbname, String tableName, String partitionName, CompactionType type)
throws TException;
/**
@@ -1260,10 +1264,10 @@ public interface IMetaStoreClient {
* in progress, and finished but waiting to clean the existing files.
* @throws TException
*/
- public ShowCompactResponse showCompactions() throws TException;
+ ShowCompactResponse showCompactions() throws TException;
- public class IncompatibleMetastoreException extends MetaException {
- public IncompatibleMetastoreException(String message) {
+ class IncompatibleMetastoreException extends MetaException {
+ IncompatibleMetastoreException(String message) {
super(message);
}
}
Modified: hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java (original)
+++ hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java Fri Aug 15 15:37:46 2014
@@ -24,6 +24,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
+import org.apache.hadoop.hive.metastore.events.ConfigChangeEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
@@ -50,6 +51,13 @@ public abstract class MetaStoreEventList
* @param tableEvent table event.
* @throws MetaException
*/
+ public void onConfigChange(ConfigChangeEvent tableEvent) throws MetaException {
+ }
+
+ /**
+ * @param tableEvent table event.
+ * @throws MetaException
+ */
public void onCreateTable (CreateTableEvent tableEvent) throws MetaException {
}
Modified: hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java (original)
+++ hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java Fri Aug 15 15:37:46 2014
@@ -43,44 +43,40 @@ public class RetryingHMSHandler implemen
private final IHMSHandler base;
private final MetaStoreInit.MetaStoreInitData metaStoreInitData =
new MetaStoreInit.MetaStoreInitData();
- private final HiveConf hiveConf;
- protected RetryingHMSHandler(final HiveConf hiveConf, final String name) throws MetaException {
+ private final HiveConf hiveConf; // base configuration
+ private final Configuration configuration; // active configuration
+
+ private RetryingHMSHandler(HiveConf hiveConf, String name, boolean local) throws MetaException {
this.hiveConf = hiveConf;
+ this.base = new HiveMetaStore.HMSHandler(name, hiveConf, false);
+ if (local) {
+ base.setConf(hiveConf); // tests expect configuration changes applied directly to metastore
+ }
+ configuration = base.getConf();
// This has to be called before initializing the instance of HMSHandler
- init();
+ // Using the hook on startup ensures that the hook always has priority
+ // over settings in *.xml. The thread local conf needs to be used because at this point
+ // it has already been initialized using hiveConf.
+ MetaStoreInit.updateConnectionURL(hiveConf, getConf(), null, metaStoreInitData);
- this.base = new HiveMetaStore.HMSHandler(name, hiveConf);
+ base.init();
}
- public static IHMSHandler getProxy(HiveConf hiveConf, String name) throws MetaException {
+ public static IHMSHandler getProxy(HiveConf hiveConf, String name, boolean local)
+ throws MetaException {
- RetryingHMSHandler handler = new RetryingHMSHandler(hiveConf, name);
+ RetryingHMSHandler handler = new RetryingHMSHandler(hiveConf, name, local);
return (IHMSHandler) Proxy.newProxyInstance(
RetryingHMSHandler.class.getClassLoader(),
new Class[] { IHMSHandler.class }, handler);
}
- private void init() throws MetaException {
- // Using the hook on startup ensures that the hook always has priority
- // over settings in *.xml. The thread local conf needs to be used because at this point
- // it has already been initialized using hiveConf.
- MetaStoreInit.updateConnectionURL(hiveConf, getConf(), null, metaStoreInitData);
-
- }
-
- private void initMS() {
- base.setConf(getConf());
- }
-
-
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- Object ret = null;
-
boolean gotNewConnectUrl = false;
boolean reloadConf = HiveConf.getBoolVar(hiveConf,
HiveConf.ConfVars.HMSHANDLERFORCERELOADCONF);
@@ -95,15 +91,14 @@ public class RetryingHMSHandler implemen
}
int retryCount = 0;
- // Exception caughtException = null;
Throwable caughtException = null;
while (true) {
try {
if (reloadConf || gotNewConnectUrl) {
- initMS();
+ base.setConf(getConf());
}
- ret = method.invoke(base, args);
- break;
+ return method.invoke(base, args);
+
} catch (javax.jdo.JDOException e) {
caughtException = e;
} catch (UndeclaredThrowableException e) {
@@ -166,10 +161,9 @@ public class RetryingHMSHandler implemen
gotNewConnectUrl = MetaStoreInit.updateConnectionURL(hiveConf, getConf(),
lastUrl, metaStoreInitData);
}
- return ret;
}
public Configuration getConf() {
- return hiveConf;
+ return configuration;
}
}
Modified: hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/StatObjectConverter.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/StatObjectConverter.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/StatObjectConverter.java (original)
+++ hive/branches/spark/metastore/src/java/org/apache/hadoop/hive/metastore/StatObjectConverter.java Fri Aug 15 15:37:46 2014
@@ -64,38 +64,54 @@ public class StatObjectConverter {
if (statsObj.getStatsData().isSetBooleanStats()) {
BooleanColumnStatsData boolStats = statsObj.getStatsData().getBooleanStats();
- mColStats.setBooleanStats(boolStats.getNumTrues(), boolStats.getNumFalses(),
- boolStats.getNumNulls());
+ mColStats.setBooleanStats(
+ boolStats.isSetNumTrues() ? boolStats.getNumTrues() : null,
+ boolStats.isSetNumFalses() ? boolStats.getNumFalses() : null,
+ boolStats.isSetNumNulls() ? boolStats.getNumNulls() : null);
} else if (statsObj.getStatsData().isSetLongStats()) {
LongColumnStatsData longStats = statsObj.getStatsData().getLongStats();
- mColStats.setLongStats(longStats.getNumNulls(), longStats.getNumDVs(),
+ mColStats.setLongStats(
+ longStats.isSetNumNulls() ? longStats.getNumNulls() : null,
+ longStats.isSetNumDVs() ? longStats.getNumDVs() : null,
longStats.isSetLowValue() ? longStats.getLowValue() : null,
longStats.isSetHighValue() ? longStats.getHighValue() : null);
} else if (statsObj.getStatsData().isSetDoubleStats()) {
DoubleColumnStatsData doubleStats = statsObj.getStatsData().getDoubleStats();
- mColStats.setDoubleStats(doubleStats.getNumNulls(), doubleStats.getNumDVs(),
+ mColStats.setDoubleStats(
+ doubleStats.isSetNumNulls() ? doubleStats.getNumNulls() : null,
+ doubleStats.isSetNumDVs() ? doubleStats.getNumDVs() : null,
doubleStats.isSetLowValue() ? doubleStats.getLowValue() : null,
doubleStats.isSetHighValue() ? doubleStats.getHighValue() : null);
} else if (statsObj.getStatsData().isSetDecimalStats()) {
DecimalColumnStatsData decimalStats = statsObj.getStatsData().getDecimalStats();
String low = decimalStats.isSetLowValue() ? createJdoDecimalString(decimalStats.getLowValue()) : null;
String high = decimalStats.isSetHighValue() ? createJdoDecimalString(decimalStats.getHighValue()) : null;
- mColStats.setDecimalStats(decimalStats.getNumNulls(), decimalStats.getNumDVs(), low, high);
+ mColStats.setDecimalStats(
+ decimalStats.isSetNumNulls() ? decimalStats.getNumNulls() : null,
+ decimalStats.isSetNumDVs() ? decimalStats.getNumDVs() : null,
+ low, high);
} else if (statsObj.getStatsData().isSetStringStats()) {
StringColumnStatsData stringStats = statsObj.getStatsData().getStringStats();
- mColStats.setStringStats(stringStats.getNumNulls(), stringStats.getNumDVs(),
- stringStats.getMaxColLen(), stringStats.getAvgColLen());
+ mColStats.setStringStats(
+ stringStats.isSetNumNulls() ? stringStats.getNumNulls() : null,
+ stringStats.isSetNumDVs() ? stringStats.getNumDVs() : null,
+ stringStats.isSetMaxColLen() ? stringStats.getMaxColLen() : null,
+ stringStats.isSetAvgColLen() ? stringStats.getAvgColLen() : null);
} else if (statsObj.getStatsData().isSetBinaryStats()) {
BinaryColumnStatsData binaryStats = statsObj.getStatsData().getBinaryStats();
- mColStats.setBinaryStats(binaryStats.getNumNulls(), binaryStats.getMaxColLen(),
- binaryStats.getAvgColLen());
+ mColStats.setBinaryStats(
+ binaryStats.isSetNumNulls() ? binaryStats.getNumNulls() : null,
+ binaryStats.isSetMaxColLen() ? binaryStats.getMaxColLen() : null,
+ binaryStats.isSetAvgColLen() ? binaryStats.getAvgColLen() : null);
}
return mColStats;
}
public static void setFieldsIntoOldStats(
MTableColumnStatistics mStatsObj, MTableColumnStatistics oldStatsObj) {
- oldStatsObj.setAvgColLen(mStatsObj.getAvgColLen());
+ if (mStatsObj.getAvgColLen() != null) {
+ oldStatsObj.setAvgColLen(mStatsObj.getAvgColLen());
+ }
if (mStatsObj.getLongHighValue() != null) {
oldStatsObj.setLongHighValue(mStatsObj.getLongHighValue());
}
@@ -114,29 +130,63 @@ public class StatObjectConverter {
if (mStatsObj.getDecimalHighValue() != null) {
oldStatsObj.setDecimalHighValue(mStatsObj.getDecimalHighValue());
}
- oldStatsObj.setMaxColLen(mStatsObj.getMaxColLen());
- oldStatsObj.setNumDVs(mStatsObj.getNumDVs());
- oldStatsObj.setNumFalses(mStatsObj.getNumFalses());
- oldStatsObj.setNumTrues(mStatsObj.getNumTrues());
- oldStatsObj.setNumNulls(mStatsObj.getNumNulls());
+ if (mStatsObj.getMaxColLen() != null) {
+ oldStatsObj.setMaxColLen(mStatsObj.getMaxColLen());
+ }
+ if (mStatsObj.getNumDVs() != null) {
+ oldStatsObj.setNumDVs(mStatsObj.getNumDVs());
+ }
+ if (mStatsObj.getNumFalses() != null) {
+ oldStatsObj.setNumFalses(mStatsObj.getNumFalses());
+ }
+ if (mStatsObj.getNumTrues() != null) {
+ oldStatsObj.setNumTrues(mStatsObj.getNumTrues());
+ }
+ if (mStatsObj.getNumNulls() != null) {
+ oldStatsObj.setNumNulls(mStatsObj.getNumNulls());
+ }
oldStatsObj.setLastAnalyzed(mStatsObj.getLastAnalyzed());
}
public static void setFieldsIntoOldStats(
MPartitionColumnStatistics mStatsObj, MPartitionColumnStatistics oldStatsObj) {
- oldStatsObj.setAvgColLen(mStatsObj.getAvgColLen());
- oldStatsObj.setLongHighValue(mStatsObj.getLongHighValue());
- oldStatsObj.setDoubleHighValue(mStatsObj.getDoubleHighValue());
+ if (mStatsObj.getAvgColLen() != null) {
+ oldStatsObj.setAvgColLen(mStatsObj.getAvgColLen());
+ }
+ if (mStatsObj.getLongHighValue() != null) {
+ oldStatsObj.setLongHighValue(mStatsObj.getLongHighValue());
+ }
+ if (mStatsObj.getDoubleHighValue() != null) {
+ oldStatsObj.setDoubleHighValue(mStatsObj.getDoubleHighValue());
+ }
oldStatsObj.setLastAnalyzed(mStatsObj.getLastAnalyzed());
- oldStatsObj.setLongLowValue(mStatsObj.getLongLowValue());
- oldStatsObj.setDoubleLowValue(mStatsObj.getDoubleLowValue());
- oldStatsObj.setDecimalLowValue(mStatsObj.getDecimalLowValue());
- oldStatsObj.setDecimalHighValue(mStatsObj.getDecimalHighValue());
- oldStatsObj.setMaxColLen(mStatsObj.getMaxColLen());
- oldStatsObj.setNumDVs(mStatsObj.getNumDVs());
- oldStatsObj.setNumFalses(mStatsObj.getNumFalses());
- oldStatsObj.setNumTrues(mStatsObj.getNumTrues());
- oldStatsObj.setNumNulls(mStatsObj.getNumNulls());
+ if (mStatsObj.getLongLowValue() != null) {
+ oldStatsObj.setLongLowValue(mStatsObj.getLongLowValue());
+ }
+ if (mStatsObj.getDoubleLowValue() != null) {
+ oldStatsObj.setDoubleLowValue(mStatsObj.getDoubleLowValue());
+ }
+ if (mStatsObj.getDecimalLowValue() != null) {
+ oldStatsObj.setDecimalLowValue(mStatsObj.getDecimalLowValue());
+ }
+ if (mStatsObj.getDecimalHighValue() != null) {
+ oldStatsObj.setDecimalHighValue(mStatsObj.getDecimalHighValue());
+ }
+ if (mStatsObj.getMaxColLen() != null) {
+ oldStatsObj.setMaxColLen(mStatsObj.getMaxColLen());
+ }
+ if (mStatsObj.getNumDVs() != null) {
+ oldStatsObj.setNumDVs(mStatsObj.getNumDVs());
+ }
+ if (mStatsObj.getNumFalses() != null) {
+ oldStatsObj.setNumFalses(mStatsObj.getNumFalses());
+ }
+ if (mStatsObj.getNumTrues() != null) {
+ oldStatsObj.setNumTrues(mStatsObj.getNumTrues());
+ }
+ if (mStatsObj.getNumNulls() != null) {
+ oldStatsObj.setNumNulls(mStatsObj.getNumNulls());
+ }
}
public static ColumnStatisticsObj getTableColumnStatisticsObj(
@@ -241,31 +291,45 @@ public class StatObjectConverter {
if (statsObj.getStatsData().isSetBooleanStats()) {
BooleanColumnStatsData boolStats = statsObj.getStatsData().getBooleanStats();
- mColStats.setBooleanStats(boolStats.getNumTrues(), boolStats.getNumFalses(),
- boolStats.getNumNulls());
+ mColStats.setBooleanStats(
+ boolStats.isSetNumTrues() ? boolStats.getNumTrues() : null,
+ boolStats.isSetNumFalses() ? boolStats.getNumFalses() : null,
+ boolStats.isSetNumNulls() ? boolStats.getNumNulls() : null);
} else if (statsObj.getStatsData().isSetLongStats()) {
LongColumnStatsData longStats = statsObj.getStatsData().getLongStats();
- mColStats.setLongStats(longStats.getNumNulls(), longStats.getNumDVs(),
+ mColStats.setLongStats(
+ longStats.isSetNumNulls() ? longStats.getNumNulls() : null,
+ longStats.isSetNumDVs() ? longStats.getNumDVs() : null,
longStats.isSetLowValue() ? longStats.getLowValue() : null,
longStats.isSetHighValue() ? longStats.getHighValue() : null);
} else if (statsObj.getStatsData().isSetDoubleStats()) {
DoubleColumnStatsData doubleStats = statsObj.getStatsData().getDoubleStats();
- mColStats.setDoubleStats(doubleStats.getNumNulls(), doubleStats.getNumDVs(),
+ mColStats.setDoubleStats(
+ doubleStats.isSetNumNulls() ? doubleStats.getNumNulls() : null,
+ doubleStats.isSetNumDVs() ? doubleStats.getNumDVs() : null,
doubleStats.isSetLowValue() ? doubleStats.getLowValue() : null,
doubleStats.isSetHighValue() ? doubleStats.getHighValue() : null);
} else if (statsObj.getStatsData().isSetDecimalStats()) {
DecimalColumnStatsData decimalStats = statsObj.getStatsData().getDecimalStats();
String low = decimalStats.isSetLowValue() ? createJdoDecimalString(decimalStats.getLowValue()) : null;
String high = decimalStats.isSetHighValue() ? createJdoDecimalString(decimalStats.getHighValue()) : null;
- mColStats.setDecimalStats(decimalStats.getNumNulls(), decimalStats.getNumDVs(), low, high);
+ mColStats.setDecimalStats(
+ decimalStats.isSetNumNulls() ? decimalStats.getNumNulls() : null,
+ decimalStats.isSetNumDVs() ? decimalStats.getNumDVs() : null,
+ low, high);
} else if (statsObj.getStatsData().isSetStringStats()) {
StringColumnStatsData stringStats = statsObj.getStatsData().getStringStats();
- mColStats.setStringStats(stringStats.getNumNulls(), stringStats.getNumDVs(),
- stringStats.getMaxColLen(), stringStats.getAvgColLen());
+ mColStats.setStringStats(
+ stringStats.isSetNumNulls() ? stringStats.getNumNulls() : null,
+ stringStats.isSetNumDVs() ? stringStats.getNumDVs() : null,
+ stringStats.isSetMaxColLen() ? stringStats.getMaxColLen() : null,
+ stringStats.isSetAvgColLen() ? stringStats.getAvgColLen() : null);
} else if (statsObj.getStatsData().isSetBinaryStats()) {
BinaryColumnStatsData binaryStats = statsObj.getStatsData().getBinaryStats();
- mColStats.setBinaryStats(binaryStats.getNumNulls(), binaryStats.getMaxColLen(),
- binaryStats.getAvgColLen());
+ mColStats.setBinaryStats(
+ binaryStats.isSetNumNulls() ? binaryStats.getNumNulls() : null,
+ binaryStats.isSetMaxColLen() ? binaryStats.getMaxColLen() : null,
+ binaryStats.isSetAvgColLen() ? binaryStats.getAvgColLen() : null);
}
return mColStats;
}
Modified: hive/branches/spark/metastore/src/model/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/model/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/model/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java (original)
+++ hive/branches/spark/metastore/src/model/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java Fri Aug 15 15:37:46 2014
@@ -46,12 +46,12 @@ public class MPartitionColumnStatistics
private Double doubleHighValue;
private String decimalLowValue;
private String decimalHighValue;
- private long numNulls;
- private long numDVs;
- private double avgColLen;
- private long maxColLen;
- private long numTrues;
- private long numFalses;
+ private Long numNulls;
+ private Long numDVs;
+ private Double avgColLen;
+ private Long maxColLen;
+ private Long numTrues;
+ private Long numFalses;
private long lastAnalyzed;
public MPartitionColumnStatistics() {}
@@ -72,7 +72,7 @@ public class MPartitionColumnStatistics
this.colName = colName;
}
- public long getNumNulls() {
+ public Long getNumNulls() {
return numNulls;
}
@@ -80,7 +80,7 @@ public class MPartitionColumnStatistics
this.numNulls = numNulls;
}
- public long getNumDVs() {
+ public Long getNumDVs() {
return numDVs;
}
@@ -88,7 +88,7 @@ public class MPartitionColumnStatistics
this.numDVs = numDVs;
}
- public double getAvgColLen() {
+ public Double getAvgColLen() {
return avgColLen;
}
@@ -96,7 +96,7 @@ public class MPartitionColumnStatistics
this.avgColLen = avgColLen;
}
- public long getMaxColLen() {
+ public Long getMaxColLen() {
return maxColLen;
}
@@ -104,7 +104,7 @@ public class MPartitionColumnStatistics
this.maxColLen = maxColLen;
}
- public long getNumTrues() {
+ public Long getNumTrues() {
return numTrues;
}
@@ -112,7 +112,7 @@ public class MPartitionColumnStatistics
this.numTrues = numTrues;
}
- public long getNumFalses() {
+ public Long getNumFalses() {
return numFalses;
}
@@ -160,20 +160,20 @@ public class MPartitionColumnStatistics
this.colType = colType;
}
- public void setBooleanStats(long numTrues, long numFalses, long numNulls) {
+ public void setBooleanStats(Long numTrues, Long numFalses, Long numNulls) {
this.numTrues = numTrues;
this.numFalses = numFalses;
this.numNulls = numNulls;
}
- public void setLongStats(long numNulls, long numNDVs, Long lowValue, Long highValue) {
+ public void setLongStats(Long numNulls, Long numNDVs, Long lowValue, Long highValue) {
this.numNulls = numNulls;
this.numDVs = numNDVs;
this.longLowValue = lowValue;
this.longHighValue = highValue;
}
- public void setDoubleStats(long numNulls, long numNDVs, Double lowValue, Double highValue) {
+ public void setDoubleStats(Long numNulls, Long numNDVs, Double lowValue, Double highValue) {
this.numNulls = numNulls;
this.numDVs = numNDVs;
this.doubleLowValue = lowValue;
@@ -181,21 +181,21 @@ public class MPartitionColumnStatistics
}
public void setDecimalStats(
- long numNulls, long numNDVs, String lowValue, String highValue) {
+ Long numNulls, Long numNDVs, String lowValue, String highValue) {
this.numNulls = numNulls;
this.numDVs = numNDVs;
this.decimalLowValue = lowValue;
this.decimalHighValue = highValue;
}
- public void setStringStats(long numNulls, long numNDVs, long maxColLen, double avgColLen) {
+ public void setStringStats(Long numNulls, Long numNDVs, Long maxColLen, Double avgColLen) {
this.numNulls = numNulls;
this.numDVs = numNDVs;
this.maxColLen = maxColLen;
this.avgColLen = avgColLen;
}
- public void setBinaryStats(long numNulls, long maxColLen, double avgColLen) {
+ public void setBinaryStats(Long numNulls, Long maxColLen, Double avgColLen) {
this.numNulls = numNulls;
this.maxColLen = maxColLen;
this.avgColLen = avgColLen;
Modified: hive/branches/spark/metastore/src/model/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/model/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/model/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java (original)
+++ hive/branches/spark/metastore/src/model/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java Fri Aug 15 15:37:46 2014
@@ -44,12 +44,12 @@ public class MTableColumnStatistics {
private Double doubleHighValue;
private String decimalLowValue;
private String decimalHighValue;
- private long numNulls;
- private long numDVs;
- private double avgColLen;
- private long maxColLen;
- private long numTrues;
- private long numFalses;
+ private Long numNulls;
+ private Long numDVs;
+ private Double avgColLen;
+ private Long maxColLen;
+ private Long numTrues;
+ private Long numFalses;
private long lastAnalyzed;
public MTableColumnStatistics() {}
@@ -86,7 +86,7 @@ public class MTableColumnStatistics {
this.colType = colType;
}
- public long getNumNulls() {
+ public Long getNumNulls() {
return numNulls;
}
@@ -94,7 +94,7 @@ public class MTableColumnStatistics {
this.numNulls = numNulls;
}
- public long getNumDVs() {
+ public Long getNumDVs() {
return numDVs;
}
@@ -102,7 +102,7 @@ public class MTableColumnStatistics {
this.numDVs = numDVs;
}
- public double getAvgColLen() {
+ public Double getAvgColLen() {
return avgColLen;
}
@@ -110,7 +110,7 @@ public class MTableColumnStatistics {
this.avgColLen = avgColLen;
}
- public long getMaxColLen() {
+ public Long getMaxColLen() {
return maxColLen;
}
@@ -118,7 +118,7 @@ public class MTableColumnStatistics {
this.maxColLen = maxColLen;
}
- public long getNumTrues() {
+ public Long getNumTrues() {
return numTrues;
}
@@ -126,7 +126,7 @@ public class MTableColumnStatistics {
this.numTrues = numTrues;
}
- public long getNumFalses() {
+ public Long getNumFalses() {
return numFalses;
}
@@ -150,20 +150,20 @@ public class MTableColumnStatistics {
this.dbName = dbName;
}
- public void setBooleanStats(long numTrues, long numFalses, long numNulls) {
+ public void setBooleanStats(Long numTrues, Long numFalses, Long numNulls) {
this.numTrues = numTrues;
this.numFalses = numFalses;
this.numNulls = numNulls;
}
- public void setLongStats(long numNulls, long numNDVs, Long lowValue, Long highValue) {
+ public void setLongStats(Long numNulls, Long numNDVs, Long lowValue, Long highValue) {
this.numNulls = numNulls;
this.numDVs = numNDVs;
this.longLowValue = lowValue;
this.longHighValue = highValue;
}
- public void setDoubleStats(long numNulls, long numNDVs, Double lowValue, Double highValue) {
+ public void setDoubleStats(Long numNulls, Long numNDVs, Double lowValue, Double highValue) {
this.numNulls = numNulls;
this.numDVs = numNDVs;
this.doubleLowValue = lowValue;
@@ -171,21 +171,21 @@ public class MTableColumnStatistics {
}
public void setDecimalStats(
- long numNulls, long numNDVs, String lowValue, String highValue) {
+ Long numNulls, Long numNDVs, String lowValue, String highValue) {
this.numNulls = numNulls;
this.numDVs = numNDVs;
this.decimalLowValue = lowValue;
this.decimalHighValue = highValue;
}
- public void setStringStats(long numNulls, long numNDVs, long maxColLen, double avgColLen) {
+ public void setStringStats(Long numNulls, Long numNDVs, Long maxColLen, Double avgColLen) {
this.numNulls = numNulls;
this.numDVs = numNDVs;
this.maxColLen = maxColLen;
this.avgColLen = avgColLen;
}
- public void setBinaryStats(long numNulls, long maxColLen, double avgColLen) {
+ public void setBinaryStats(Long numNulls, Long maxColLen, Double avgColLen) {
this.numNulls = numNulls;
this.maxColLen = maxColLen;
this.avgColLen = avgColLen;
Modified: hive/branches/spark/metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java?rev=1618215&r1=1618214&r2=1618215&view=diff
==============================================================================
--- hive/branches/spark/metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java (original)
+++ hive/branches/spark/metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java Fri Aug 15 15:37:46 2014
@@ -26,6 +26,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
+import org.apache.hadoop.hive.metastore.events.ConfigChangeEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
@@ -58,6 +59,11 @@ public class DummyListener extends MetaS
}
@Override
+ public void onConfigChange(ConfigChangeEvent configChange) {
+ notifyList.add(configChange);
+ }
+
+ @Override
public void onAddPartition(AddPartitionEvent partition) throws MetaException {
notifyList.add(partition);
}