diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 8490558..e716d09 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -68,6 +68,7 @@ private static final Map vars = new HashMap(); + private static final Map metaConfs = new HashMap(); private final List restrictList = new ArrayList(); private boolean isWhiteListRestrictionEnabled = false; @@ -153,6 +154,19 @@ HiveConf.ConfVars.HIVE_TXN_MAX_OPEN_BATCH, }; + /** + * User configurable Metastore vars + */ + public static final HiveConf.ConfVars[] metaConfVars = { + HiveConf.ConfVars.METASTORE_TRY_DIRECT_SQL, + HiveConf.ConfVars.METASTORE_TRY_DIRECT_SQL_DDL + }; + + static { + for (ConfVars confVar : metaConfVars) { + metaConfs.put(confVar.varname, confVar); + } + } /** * dbVars are the parameters can be set per database. If these @@ -2027,6 +2041,10 @@ public static ConfVars getConfVars(String name) { return vars.get(name); } + public static ConfVars getMetaConf(String name) { + return metaConfs.get(name); + } + public String getVar(ConfVars var) { return getVar(this, var); } diff --git common/src/java/org/apache/hadoop/hive/conf/SystemVariables.java common/src/java/org/apache/hadoop/hive/conf/SystemVariables.java index ee98d17..0bbed90 100644 --- common/src/java/org/apache/hadoop/hive/conf/SystemVariables.java +++ common/src/java/org/apache/hadoop/hive/conf/SystemVariables.java @@ -33,6 +33,7 @@ public static final String SYSTEM_PREFIX = "system:"; public static final String HIVECONF_PREFIX = "hiveconf:"; public static final String HIVEVAR_PREFIX = "hivevar:"; + public static final String METACONF_PREFIX = "metaconf:"; public static final String SET_COLUMN_NAME = "set"; protected String getSubstitute(Configuration conf, String var) { diff --git itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java index 9e416b5..1f6748b 100644 --- itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java +++ itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreEventListener.java @@ -35,6 +35,7 @@ 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; @@ -53,6 +54,7 @@ import org.apache.hadoop.hive.metastore.events.PreEventContext; import org.apache.hadoop.hive.metastore.events.PreLoadPartitionDoneEvent; import org.apache.hadoop.hive.ql.Driver; +import org.apache.hadoop.hive.ql.processors.SetProcessor; import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hadoop.hive.shims.ShimLoader; @@ -377,6 +379,12 @@ public void testListener() throws Exception { PreDropDatabaseEvent preDropDB = (PreDropDatabaseEvent)preNotifyList.get(listSize-1); assert dropDB.getStatus(); validateDropDb(db, preDropDB.getDatabase()); + + SetProcessor.setVariable("metaconf:hive.metastore.try.direct.sql", "false"); + ConfigChangeEvent event = (ConfigChangeEvent) notifyList.get(notifyList.size() - 1); + assertEquals("hive.metastore.try.direct.sql", event.getKey()); + assertEquals("true", event.getOldValue()); + assertEquals("false", event.getNewValue()); } } diff --git metastore/if/hive_metastore.thrift metastore/if/hive_metastore.thrift index 9e93b95..cb326f4 100755 --- metastore/if/hive_metastore.thrift +++ metastore/if/hive_metastore.thrift @@ -682,6 +682,9 @@ exception NoSuchLockException { */ service ThriftHiveMetastore extends fb303.FacebookService { + string getMetaConf(1:string key) throws(1:MetaException o1) + void setMetaConf(1:string key, 2:string value) throws(1:MetaException o1) + void create_database(1:Database database) throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3) Database get_database(1:string name) throws(1:NoSuchObjectException o1, 2:MetaException o2) void drop_database(1:string name, 2:bool deleteData, 3:bool cascade) throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp index 5fbd1de..23b5edf 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp @@ -8,6 +8,366 @@ namespace Apache { namespace Hadoop { namespace Hive { +uint32_t ThriftHiveMetastore_getMetaConf_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->key); + this->__isset.key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_getMetaConf_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_getMetaConf_args"); + + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->key); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_getMetaConf_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_getMetaConf_pargs"); + + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->key))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_getMetaConf_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_getMetaConf_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftHiveMetastore_getMetaConf_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.o1) { + xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->o1.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_getMetaConf_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_setMetaConf_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->key); + this->__isset.key = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->value); + this->__isset.value = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_setMetaConf_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_setMetaConf_args"); + + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->key); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("value", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->value); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_setMetaConf_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_setMetaConf_pargs"); + + xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->key))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("value", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString((*(this->value))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_setMetaConf_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_setMetaConf_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftHiveMetastore_setMetaConf_result"); + + if (this->__isset.o1) { + xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->o1.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_setMetaConf_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + uint32_t ThriftHiveMetastore_create_database_args::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; @@ -25464,6 +25824,124 @@ uint32_t ThriftHiveMetastore_show_compact_presult::read(::apache::thrift::protoc return xfer; } +void ThriftHiveMetastoreClient::getMetaConf(std::string& _return, const std::string& key) +{ + send_getMetaConf(key); + recv_getMetaConf(_return); +} + +void ThriftHiveMetastoreClient::send_getMetaConf(const std::string& key) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("getMetaConf", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_getMetaConf_pargs args; + args.key = &key; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void ThriftHiveMetastoreClient::recv_getMetaConf(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("getMetaConf") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + ThriftHiveMetastore_getMetaConf_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.o1) { + throw result.o1; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getMetaConf failed: unknown result"); +} + +void ThriftHiveMetastoreClient::setMetaConf(const std::string& key, const std::string& value) +{ + send_setMetaConf(key, value); + recv_setMetaConf(); +} + +void ThriftHiveMetastoreClient::send_setMetaConf(const std::string& key, const std::string& value) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("setMetaConf", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_setMetaConf_pargs args; + args.key = &key; + args.value = &value; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void ThriftHiveMetastoreClient::recv_setMetaConf() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("setMetaConf") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + ThriftHiveMetastore_setMetaConf_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.o1) { + throw result.o1; + } + return; +} + void ThriftHiveMetastoreClient::create_database(const Database& database) { send_create_database(database); @@ -32535,6 +33013,119 @@ bool ThriftHiveMetastoreProcessor::dispatchCall(::apache::thrift::protocol::TPro return true; } +void ThriftHiveMetastoreProcessor::process_getMetaConf(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("ThriftHiveMetastore.getMetaConf", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftHiveMetastore.getMetaConf"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftHiveMetastore.getMetaConf"); + } + + ThriftHiveMetastore_getMetaConf_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftHiveMetastore.getMetaConf", bytes); + } + + ThriftHiveMetastore_getMetaConf_result result; + try { + iface_->getMetaConf(result.success, args.key); + result.__isset.success = true; + } catch (MetaException &o1) { + result.o1 = o1; + result.__isset.o1 = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftHiveMetastore.getMetaConf"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("getMetaConf", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "ThriftHiveMetastore.getMetaConf"); + } + + oprot->writeMessageBegin("getMetaConf", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "ThriftHiveMetastore.getMetaConf", bytes); + } +} + +void ThriftHiveMetastoreProcessor::process_setMetaConf(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("ThriftHiveMetastore.setMetaConf", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftHiveMetastore.setMetaConf"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftHiveMetastore.setMetaConf"); + } + + ThriftHiveMetastore_setMetaConf_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftHiveMetastore.setMetaConf", bytes); + } + + ThriftHiveMetastore_setMetaConf_result result; + try { + iface_->setMetaConf(args.key, args.value); + } catch (MetaException &o1) { + result.o1 = o1; + result.__isset.o1 = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftHiveMetastore.setMetaConf"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("setMetaConf", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "ThriftHiveMetastore.setMetaConf"); + } + + oprot->writeMessageBegin("setMetaConf", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "ThriftHiveMetastore.setMetaConf", bytes); + } +} + void ThriftHiveMetastoreProcessor::process_create_database(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) { void* ctx = NULL; diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h index 35894a2..0e328dd 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h @@ -16,6 +16,8 @@ namespace Apache { namespace Hadoop { namespace Hive { class ThriftHiveMetastoreIf : virtual public ::facebook::fb303::FacebookServiceIf { public: virtual ~ThriftHiveMetastoreIf() {} + virtual void getMetaConf(std::string& _return, const std::string& key) = 0; + virtual void setMetaConf(const std::string& key, const std::string& value) = 0; virtual void create_database(const Database& database) = 0; virtual void get_database(Database& _return, const std::string& name) = 0; virtual void drop_database(const std::string& name, const bool deleteData, const bool cascade) = 0; @@ -155,6 +157,12 @@ class ThriftHiveMetastoreIfSingletonFactory : virtual public ThriftHiveMetastore class ThriftHiveMetastoreNull : virtual public ThriftHiveMetastoreIf , virtual public ::facebook::fb303::FacebookServiceNull { public: virtual ~ThriftHiveMetastoreNull() {} + void getMetaConf(std::string& /* _return */, const std::string& /* key */) { + return; + } + void setMetaConf(const std::string& /* key */, const std::string& /* value */) { + return; + } void create_database(const Database& /* database */) { return; } @@ -508,6 +516,241 @@ class ThriftHiveMetastoreNull : virtual public ThriftHiveMetastoreIf , virtual p } }; +typedef struct _ThriftHiveMetastore_getMetaConf_args__isset { + _ThriftHiveMetastore_getMetaConf_args__isset() : key(false) {} + bool key; +} _ThriftHiveMetastore_getMetaConf_args__isset; + +class ThriftHiveMetastore_getMetaConf_args { + public: + + ThriftHiveMetastore_getMetaConf_args() : key() { + } + + virtual ~ThriftHiveMetastore_getMetaConf_args() throw() {} + + std::string key; + + _ThriftHiveMetastore_getMetaConf_args__isset __isset; + + void __set_key(const std::string& val) { + key = val; + } + + bool operator == (const ThriftHiveMetastore_getMetaConf_args & rhs) const + { + if (!(key == rhs.key)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_getMetaConf_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_getMetaConf_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftHiveMetastore_getMetaConf_pargs { + public: + + + virtual ~ThriftHiveMetastore_getMetaConf_pargs() throw() {} + + const std::string* key; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_getMetaConf_result__isset { + _ThriftHiveMetastore_getMetaConf_result__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_getMetaConf_result__isset; + +class ThriftHiveMetastore_getMetaConf_result { + public: + + ThriftHiveMetastore_getMetaConf_result() : success() { + } + + virtual ~ThriftHiveMetastore_getMetaConf_result() throw() {} + + std::string success; + MetaException o1; + + _ThriftHiveMetastore_getMetaConf_result__isset __isset; + + void __set_success(const std::string& val) { + success = val; + } + + void __set_o1(const MetaException& val) { + o1 = val; + } + + bool operator == (const ThriftHiveMetastore_getMetaConf_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(o1 == rhs.o1)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_getMetaConf_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_getMetaConf_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_getMetaConf_presult__isset { + _ThriftHiveMetastore_getMetaConf_presult__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_getMetaConf_presult__isset; + +class ThriftHiveMetastore_getMetaConf_presult { + public: + + + virtual ~ThriftHiveMetastore_getMetaConf_presult() throw() {} + + std::string* success; + MetaException o1; + + _ThriftHiveMetastore_getMetaConf_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _ThriftHiveMetastore_setMetaConf_args__isset { + _ThriftHiveMetastore_setMetaConf_args__isset() : key(false), value(false) {} + bool key; + bool value; +} _ThriftHiveMetastore_setMetaConf_args__isset; + +class ThriftHiveMetastore_setMetaConf_args { + public: + + ThriftHiveMetastore_setMetaConf_args() : key(), value() { + } + + virtual ~ThriftHiveMetastore_setMetaConf_args() throw() {} + + std::string key; + std::string value; + + _ThriftHiveMetastore_setMetaConf_args__isset __isset; + + void __set_key(const std::string& val) { + key = val; + } + + void __set_value(const std::string& val) { + value = val; + } + + bool operator == (const ThriftHiveMetastore_setMetaConf_args & rhs) const + { + if (!(key == rhs.key)) + return false; + if (!(value == rhs.value)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_setMetaConf_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_setMetaConf_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftHiveMetastore_setMetaConf_pargs { + public: + + + virtual ~ThriftHiveMetastore_setMetaConf_pargs() throw() {} + + const std::string* key; + const std::string* value; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_setMetaConf_result__isset { + _ThriftHiveMetastore_setMetaConf_result__isset() : o1(false) {} + bool o1; +} _ThriftHiveMetastore_setMetaConf_result__isset; + +class ThriftHiveMetastore_setMetaConf_result { + public: + + ThriftHiveMetastore_setMetaConf_result() { + } + + virtual ~ThriftHiveMetastore_setMetaConf_result() throw() {} + + MetaException o1; + + _ThriftHiveMetastore_setMetaConf_result__isset __isset; + + void __set_o1(const MetaException& val) { + o1 = val; + } + + bool operator == (const ThriftHiveMetastore_setMetaConf_result & rhs) const + { + if (!(o1 == rhs.o1)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_setMetaConf_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_setMetaConf_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_setMetaConf_presult__isset { + _ThriftHiveMetastore_setMetaConf_presult__isset() : o1(false) {} + bool o1; +} _ThriftHiveMetastore_setMetaConf_presult__isset; + +class ThriftHiveMetastore_setMetaConf_presult { + public: + + + virtual ~ThriftHiveMetastore_setMetaConf_presult() throw() {} + + MetaException o1; + + _ThriftHiveMetastore_setMetaConf_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + typedef struct _ThriftHiveMetastore_create_database_args__isset { _ThriftHiveMetastore_create_database_args__isset() : database(false) {} bool database; @@ -15582,6 +15825,12 @@ class ThriftHiveMetastoreClient : virtual public ThriftHiveMetastoreIf, public boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } + void getMetaConf(std::string& _return, const std::string& key); + void send_getMetaConf(const std::string& key); + void recv_getMetaConf(std::string& _return); + void setMetaConf(const std::string& key, const std::string& value); + void send_setMetaConf(const std::string& key, const std::string& value); + void recv_setMetaConf(); void create_database(const Database& database); void send_create_database(const Database& database); void recv_create_database(); @@ -15922,6 +16171,8 @@ class ThriftHiveMetastoreProcessor : public ::facebook::fb303::FacebookServiceP typedef void (ThriftHiveMetastoreProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); typedef std::map ProcessMap; ProcessMap processMap_; + void process_getMetaConf(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_setMetaConf(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_create_database(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_database(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_drop_database(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); @@ -16036,6 +16287,8 @@ class ThriftHiveMetastoreProcessor : public ::facebook::fb303::FacebookServiceP ThriftHiveMetastoreProcessor(boost::shared_ptr iface) : ::facebook::fb303::FacebookServiceProcessor(iface), iface_(iface) { + processMap_["getMetaConf"] = &ThriftHiveMetastoreProcessor::process_getMetaConf; + processMap_["setMetaConf"] = &ThriftHiveMetastoreProcessor::process_setMetaConf; processMap_["create_database"] = &ThriftHiveMetastoreProcessor::process_create_database; processMap_["get_database"] = &ThriftHiveMetastoreProcessor::process_get_database; processMap_["drop_database"] = &ThriftHiveMetastoreProcessor::process_drop_database; @@ -16179,6 +16432,25 @@ class ThriftHiveMetastoreMultiface : virtual public ThriftHiveMetastoreIf, publi ifaces_.push_back(iface); } public: + void getMetaConf(std::string& _return, const std::string& key) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getMetaConf(_return, key); + } + ifaces_[i]->getMetaConf(_return, key); + return; + } + + void setMetaConf(const std::string& key, const std::string& value) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->setMetaConf(key, value); + } + ifaces_[i]->setMetaConf(key, value); + } + void create_database(const Database& database) { size_t sz = ifaces_.size(); size_t i = 0; diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp index 822e8d7..4bcb2e6 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp @@ -22,6 +22,16 @@ class ThriftHiveMetastoreHandler : virtual public ThriftHiveMetastoreIf { // Your initialization goes here } + void getMetaConf(std::string& _return, const std::string& key) { + // Your implementation goes here + printf("getMetaConf\n"); + } + + void setMetaConf(const std::string& key, const std::string& value) { + // Your implementation goes here + printf("setMetaConf\n"); + } + void create_database(const Database& database) { // Your implementation goes here printf("create_database\n"); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java index e2bc91f..fb06b6c 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java @@ -38,6 +38,10 @@ */ public interface Iface extends com.facebook.fb303.FacebookService.Iface { + public String getMetaConf(String key) throws MetaException, org.apache.thrift.TException; + + public void setMetaConf(String key, String value) throws MetaException, org.apache.thrift.TException; + public void create_database(Database database) throws AlreadyExistsException, InvalidObjectException, MetaException, org.apache.thrift.TException; public Database get_database(String name) throws NoSuchObjectException, MetaException, org.apache.thrift.TException; @@ -262,6 +266,10 @@ public interface AsyncIface extends com.facebook.fb303.FacebookService .AsyncIface { + public void getMetaConf(String key, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void setMetaConf(String key, String value, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void create_database(Database database, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void get_database(String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -504,6 +512,56 @@ public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.prot super(iprot, oprot); } + public String getMetaConf(String key) throws MetaException, org.apache.thrift.TException + { + send_getMetaConf(key); + return recv_getMetaConf(); + } + + public void send_getMetaConf(String key) throws org.apache.thrift.TException + { + getMetaConf_args args = new getMetaConf_args(); + args.setKey(key); + sendBase("getMetaConf", args); + } + + public String recv_getMetaConf() throws MetaException, org.apache.thrift.TException + { + getMetaConf_result result = new getMetaConf_result(); + receiveBase(result, "getMetaConf"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.o1 != null) { + throw result.o1; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getMetaConf failed: unknown result"); + } + + public void setMetaConf(String key, String value) throws MetaException, org.apache.thrift.TException + { + send_setMetaConf(key, value); + recv_setMetaConf(); + } + + public void send_setMetaConf(String key, String value) throws org.apache.thrift.TException + { + setMetaConf_args args = new setMetaConf_args(); + args.setKey(key); + args.setValue(value); + sendBase("setMetaConf", args); + } + + public void recv_setMetaConf() throws MetaException, org.apache.thrift.TException + { + setMetaConf_result result = new setMetaConf_result(); + receiveBase(result, "setMetaConf"); + if (result.o1 != null) { + throw result.o1; + } + return; + } + public void create_database(Database database) throws AlreadyExistsException, InvalidObjectException, MetaException, org.apache.thrift.TException { send_create_database(database); @@ -3781,6 +3839,73 @@ public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, super(protocolFactory, clientManager, transport); } + public void getMetaConf(String key, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getMetaConf_call method_call = new getMetaConf_call(key, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getMetaConf_call extends org.apache.thrift.async.TAsyncMethodCall { + private String key; + public getMetaConf_call(String key, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.key = key; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getMetaConf", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getMetaConf_args args = new getMetaConf_args(); + args.setKey(key); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws MetaException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getMetaConf(); + } + } + + public void setMetaConf(String key, String value, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + setMetaConf_call method_call = new setMetaConf_call(key, value, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class setMetaConf_call extends org.apache.thrift.async.TAsyncMethodCall { + private String key; + private String value; + public setMetaConf_call(String key, String value, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.key = key; + this.value = value; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("setMetaConf", org.apache.thrift.protocol.TMessageType.CALL, 0)); + setMetaConf_args args = new setMetaConf_args(); + args.setKey(key); + args.setValue(value); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws MetaException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_setMetaConf(); + } + } + public void create_database(Database database, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); create_database_call method_call = new create_database_call(database, resultHandler, this, ___protocolFactory, ___transport); @@ -7728,6 +7853,8 @@ protected Processor(I iface, Map Map> getProcessMap(Map> processMap) { + processMap.put("getMetaConf", new getMetaConf()); + processMap.put("setMetaConf", new setMetaConf()); processMap.put("create_database", new create_database()); processMap.put("get_database", new get_database()); processMap.put("drop_database", new drop_database()); @@ -7841,6 +7968,54 @@ protected Processor(I iface, Map extends org.apache.thrift.ProcessFunction { + public getMetaConf() { + super("getMetaConf"); + } + + public getMetaConf_args getEmptyArgsInstance() { + return new getMetaConf_args(); + } + + protected boolean isOneway() { + return false; + } + + public getMetaConf_result getResult(I iface, getMetaConf_args args) throws org.apache.thrift.TException { + getMetaConf_result result = new getMetaConf_result(); + try { + result.success = iface.getMetaConf(args.key); + } catch (MetaException o1) { + result.o1 = o1; + } + return result; + } + } + + public static class setMetaConf extends org.apache.thrift.ProcessFunction { + public setMetaConf() { + super("setMetaConf"); + } + + public setMetaConf_args getEmptyArgsInstance() { + return new setMetaConf_args(); + } + + protected boolean isOneway() { + return false; + } + + public setMetaConf_result getResult(I iface, setMetaConf_args args) throws org.apache.thrift.TException { + setMetaConf_result result = new setMetaConf_result(); + try { + iface.setMetaConf(args.key, args.value); + } catch (MetaException o1) { + result.o1 = o1; + } + return result; + } + } + public static class create_database extends org.apache.thrift.ProcessFunction { public create_database() { super("create_database"); @@ -10712,6 +10887,1650 @@ public show_compact_result getResult(I iface, show_compact_args args) throws org } + public static class getMetaConf_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getMetaConf_args"); + + private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getMetaConf_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getMetaConf_argsTupleSchemeFactory()); + } + + private String key; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + KEY((short)1, "key"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // KEY + return KEY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getMetaConf_args.class, metaDataMap); + } + + public getMetaConf_args() { + } + + public getMetaConf_args( + String key) + { + this(); + this.key = key; + } + + /** + * Performs a deep copy on other. + */ + public getMetaConf_args(getMetaConf_args other) { + if (other.isSetKey()) { + this.key = other.key; + } + } + + public getMetaConf_args deepCopy() { + return new getMetaConf_args(this); + } + + @Override + public void clear() { + this.key = null; + } + + public String getKey() { + return this.key; + } + + public void setKey(String key) { + this.key = key; + } + + public void unsetKey() { + this.key = null; + } + + /** Returns true if field key is set (has been assigned a value) and false otherwise */ + public boolean isSetKey() { + return this.key != null; + } + + public void setKeyIsSet(boolean value) { + if (!value) { + this.key = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case KEY: + if (value == null) { + unsetKey(); + } else { + setKey((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case KEY: + return getKey(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case KEY: + return isSetKey(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getMetaConf_args) + return this.equals((getMetaConf_args)that); + return false; + } + + public boolean equals(getMetaConf_args that) { + if (that == null) + return false; + + boolean this_present_key = true && this.isSetKey(); + boolean that_present_key = true && that.isSetKey(); + if (this_present_key || that_present_key) { + if (!(this_present_key && that_present_key)) + return false; + if (!this.key.equals(that.key)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_key = true && (isSetKey()); + builder.append(present_key); + if (present_key) + builder.append(key); + + return builder.toHashCode(); + } + + public int compareTo(getMetaConf_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + getMetaConf_args typedOther = (getMetaConf_args)other; + + lastComparison = Boolean.valueOf(isSetKey()).compareTo(typedOther.isSetKey()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetKey()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, typedOther.key); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getMetaConf_args("); + boolean first = true; + + sb.append("key:"); + if (this.key == null) { + sb.append("null"); + } else { + sb.append(this.key); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getMetaConf_argsStandardSchemeFactory implements SchemeFactory { + public getMetaConf_argsStandardScheme getScheme() { + return new getMetaConf_argsStandardScheme(); + } + } + + private static class getMetaConf_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getMetaConf_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // KEY + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.key = iprot.readString(); + struct.setKeyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getMetaConf_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.key != null) { + oprot.writeFieldBegin(KEY_FIELD_DESC); + oprot.writeString(struct.key); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getMetaConf_argsTupleSchemeFactory implements SchemeFactory { + public getMetaConf_argsTupleScheme getScheme() { + return new getMetaConf_argsTupleScheme(); + } + } + + private static class getMetaConf_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getMetaConf_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetKey()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetKey()) { + oprot.writeString(struct.key); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getMetaConf_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.key = iprot.readString(); + struct.setKeyIsSet(true); + } + } + } + + } + + public static class getMetaConf_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getMetaConf_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); + private static final org.apache.thrift.protocol.TField O1_FIELD_DESC = new org.apache.thrift.protocol.TField("o1", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getMetaConf_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getMetaConf_resultTupleSchemeFactory()); + } + + private String success; // required + private MetaException o1; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"), + O1((short)1, "o1"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + case 1: // O1 + return O1; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getMetaConf_result.class, metaDataMap); + } + + public getMetaConf_result() { + } + + public getMetaConf_result( + String success, + MetaException o1) + { + this(); + this.success = success; + this.o1 = o1; + } + + /** + * Performs a deep copy on other. + */ + public getMetaConf_result(getMetaConf_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + if (other.isSetO1()) { + this.o1 = new MetaException(other.o1); + } + } + + public getMetaConf_result deepCopy() { + return new getMetaConf_result(this); + } + + @Override + public void clear() { + this.success = null; + this.o1 = null; + } + + public String getSuccess() { + return this.success; + } + + public void setSuccess(String success) { + this.success = success; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public MetaException getO1() { + return this.o1; + } + + public void setO1(MetaException o1) { + this.o1 = o1; + } + + public void unsetO1() { + this.o1 = null; + } + + /** Returns true if field o1 is set (has been assigned a value) and false otherwise */ + public boolean isSetO1() { + return this.o1 != null; + } + + public void setO1IsSet(boolean value) { + if (!value) { + this.o1 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String)value); + } + break; + + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((MetaException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case O1: + return getO1(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + case O1: + return isSetO1(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getMetaConf_result) + return this.equals((getMetaConf_result)that); + return false; + } + + public boolean equals(getMetaConf_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_o1 = true && this.isSetO1(); + boolean that_present_o1 = true && that.isSetO1(); + if (this_present_o1 || that_present_o1) { + if (!(this_present_o1 && that_present_o1)) + return false; + if (!this.o1.equals(that.o1)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_success = true && (isSetSuccess()); + builder.append(present_success); + if (present_success) + builder.append(success); + + boolean present_o1 = true && (isSetO1()); + builder.append(present_o1); + if (present_o1) + builder.append(o1); + + return builder.toHashCode(); + } + + public int compareTo(getMetaConf_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + getMetaConf_result typedOther = (getMetaConf_result)other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o1, typedOther.o1); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getMetaConf_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getMetaConf_resultStandardSchemeFactory implements SchemeFactory { + public getMetaConf_resultStandardScheme getScheme() { + return new getMetaConf_resultStandardScheme(); + } + } + + private static class getMetaConf_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getMetaConf_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // O1 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.o1 = new MetaException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getMetaConf_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + if (struct.o1 != null) { + oprot.writeFieldBegin(O1_FIELD_DESC); + struct.o1.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getMetaConf_resultTupleSchemeFactory implements SchemeFactory { + public getMetaConf_resultTupleScheme getScheme() { + return new getMetaConf_resultTupleScheme(); + } + } + + private static class getMetaConf_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getMetaConf_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetO1()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + if (struct.isSetO1()) { + struct.o1.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getMetaConf_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.o1 = new MetaException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } + } + } + + } + + public static class setMetaConf_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("setMetaConf_args"); + + private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new setMetaConf_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new setMetaConf_argsTupleSchemeFactory()); + } + + private String key; // required + private String value; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + KEY((short)1, "key"), + VALUE((short)2, "value"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // KEY + return KEY; + case 2: // VALUE + return VALUE; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(setMetaConf_args.class, metaDataMap); + } + + public setMetaConf_args() { + } + + public setMetaConf_args( + String key, + String value) + { + this(); + this.key = key; + this.value = value; + } + + /** + * Performs a deep copy on other. + */ + public setMetaConf_args(setMetaConf_args other) { + if (other.isSetKey()) { + this.key = other.key; + } + if (other.isSetValue()) { + this.value = other.value; + } + } + + public setMetaConf_args deepCopy() { + return new setMetaConf_args(this); + } + + @Override + public void clear() { + this.key = null; + this.value = null; + } + + public String getKey() { + return this.key; + } + + public void setKey(String key) { + this.key = key; + } + + public void unsetKey() { + this.key = null; + } + + /** Returns true if field key is set (has been assigned a value) and false otherwise */ + public boolean isSetKey() { + return this.key != null; + } + + public void setKeyIsSet(boolean value) { + if (!value) { + this.key = null; + } + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + public void unsetValue() { + this.value = null; + } + + /** Returns true if field value is set (has been assigned a value) and false otherwise */ + public boolean isSetValue() { + return this.value != null; + } + + public void setValueIsSet(boolean value) { + if (!value) { + this.value = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case KEY: + if (value == null) { + unsetKey(); + } else { + setKey((String)value); + } + break; + + case VALUE: + if (value == null) { + unsetValue(); + } else { + setValue((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case KEY: + return getKey(); + + case VALUE: + return getValue(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case KEY: + return isSetKey(); + case VALUE: + return isSetValue(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof setMetaConf_args) + return this.equals((setMetaConf_args)that); + return false; + } + + public boolean equals(setMetaConf_args that) { + if (that == null) + return false; + + boolean this_present_key = true && this.isSetKey(); + boolean that_present_key = true && that.isSetKey(); + if (this_present_key || that_present_key) { + if (!(this_present_key && that_present_key)) + return false; + if (!this.key.equals(that.key)) + return false; + } + + boolean this_present_value = true && this.isSetValue(); + boolean that_present_value = true && that.isSetValue(); + if (this_present_value || that_present_value) { + if (!(this_present_value && that_present_value)) + return false; + if (!this.value.equals(that.value)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_key = true && (isSetKey()); + builder.append(present_key); + if (present_key) + builder.append(key); + + boolean present_value = true && (isSetValue()); + builder.append(present_value); + if (present_value) + builder.append(value); + + return builder.toHashCode(); + } + + public int compareTo(setMetaConf_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + setMetaConf_args typedOther = (setMetaConf_args)other; + + lastComparison = Boolean.valueOf(isSetKey()).compareTo(typedOther.isSetKey()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetKey()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, typedOther.key); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValue()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("setMetaConf_args("); + boolean first = true; + + sb.append("key:"); + if (this.key == null) { + sb.append("null"); + } else { + sb.append(this.key); + } + first = false; + if (!first) sb.append(", "); + sb.append("value:"); + if (this.value == null) { + sb.append("null"); + } else { + sb.append(this.value); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class setMetaConf_argsStandardSchemeFactory implements SchemeFactory { + public setMetaConf_argsStandardScheme getScheme() { + return new setMetaConf_argsStandardScheme(); + } + } + + private static class setMetaConf_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, setMetaConf_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // KEY + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.key = iprot.readString(); + struct.setKeyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // VALUE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.value = iprot.readString(); + struct.setValueIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, setMetaConf_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.key != null) { + oprot.writeFieldBegin(KEY_FIELD_DESC); + oprot.writeString(struct.key); + oprot.writeFieldEnd(); + } + if (struct.value != null) { + oprot.writeFieldBegin(VALUE_FIELD_DESC); + oprot.writeString(struct.value); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class setMetaConf_argsTupleSchemeFactory implements SchemeFactory { + public setMetaConf_argsTupleScheme getScheme() { + return new setMetaConf_argsTupleScheme(); + } + } + + private static class setMetaConf_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, setMetaConf_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetKey()) { + optionals.set(0); + } + if (struct.isSetValue()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetKey()) { + oprot.writeString(struct.key); + } + if (struct.isSetValue()) { + oprot.writeString(struct.value); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, setMetaConf_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.key = iprot.readString(); + struct.setKeyIsSet(true); + } + if (incoming.get(1)) { + struct.value = iprot.readString(); + struct.setValueIsSet(true); + } + } + } + + } + + public static class setMetaConf_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("setMetaConf_result"); + + private static final org.apache.thrift.protocol.TField O1_FIELD_DESC = new org.apache.thrift.protocol.TField("o1", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new setMetaConf_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new setMetaConf_resultTupleSchemeFactory()); + } + + private MetaException o1; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + O1((short)1, "o1"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // O1 + return O1; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(setMetaConf_result.class, metaDataMap); + } + + public setMetaConf_result() { + } + + public setMetaConf_result( + MetaException o1) + { + this(); + this.o1 = o1; + } + + /** + * Performs a deep copy on other. + */ + public setMetaConf_result(setMetaConf_result other) { + if (other.isSetO1()) { + this.o1 = new MetaException(other.o1); + } + } + + public setMetaConf_result deepCopy() { + return new setMetaConf_result(this); + } + + @Override + public void clear() { + this.o1 = null; + } + + public MetaException getO1() { + return this.o1; + } + + public void setO1(MetaException o1) { + this.o1 = o1; + } + + public void unsetO1() { + this.o1 = null; + } + + /** Returns true if field o1 is set (has been assigned a value) and false otherwise */ + public boolean isSetO1() { + return this.o1 != null; + } + + public void setO1IsSet(boolean value) { + if (!value) { + this.o1 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((MetaException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case O1: + return getO1(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case O1: + return isSetO1(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof setMetaConf_result) + return this.equals((setMetaConf_result)that); + return false; + } + + public boolean equals(setMetaConf_result that) { + if (that == null) + return false; + + boolean this_present_o1 = true && this.isSetO1(); + boolean that_present_o1 = true && that.isSetO1(); + if (this_present_o1 || that_present_o1) { + if (!(this_present_o1 && that_present_o1)) + return false; + if (!this.o1.equals(that.o1)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_o1 = true && (isSetO1()); + builder.append(present_o1); + if (present_o1) + builder.append(o1); + + return builder.toHashCode(); + } + + public int compareTo(setMetaConf_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + setMetaConf_result typedOther = (setMetaConf_result)other; + + lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o1, typedOther.o1); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("setMetaConf_result("); + boolean first = true; + + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class setMetaConf_resultStandardSchemeFactory implements SchemeFactory { + public setMetaConf_resultStandardScheme getScheme() { + return new setMetaConf_resultStandardScheme(); + } + } + + private static class setMetaConf_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, setMetaConf_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // O1 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.o1 = new MetaException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, setMetaConf_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.o1 != null) { + oprot.writeFieldBegin(O1_FIELD_DESC); + struct.o1.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class setMetaConf_resultTupleSchemeFactory implements SchemeFactory { + public setMetaConf_resultTupleScheme getScheme() { + return new setMetaConf_resultTupleScheme(); + } + } + + private static class setMetaConf_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, setMetaConf_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetO1()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetO1()) { + struct.o1.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, setMetaConf_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.o1 = new MetaException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } + } + } + + } + public static class create_database_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_database_args"); diff --git metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php index 3f5c737..653b60c 100644 --- metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php +++ metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php @@ -16,6 +16,8 @@ use Thrift\Exception\TApplicationException; interface ThriftHiveMetastoreIf extends \FacebookServiceIf { + public function getMetaConf($key); + public function setMetaConf($key, $value); public function create_database(\metastore\Database $database); public function get_database($name); public function drop_database($name, $deleteData, $cascade); @@ -133,6 +135,112 @@ class ThriftHiveMetastoreClient extends \FacebookServiceClient implements \metas parent::__construct($input, $output); } + public function getMetaConf($key) + { + $this->send_getMetaConf($key); + return $this->recv_getMetaConf(); + } + + public function send_getMetaConf($key) + { + $args = new \metastore\ThriftHiveMetastore_getMetaConf_args(); + $args->key = $key; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'getMetaConf', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('getMetaConf', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_getMetaConf() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\metastore\ThriftHiveMetastore_getMetaConf_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new \metastore\ThriftHiveMetastore_getMetaConf_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + if ($result->o1 !== null) { + throw $result->o1; + } + throw new \Exception("getMetaConf failed: unknown result"); + } + + public function setMetaConf($key, $value) + { + $this->send_setMetaConf($key, $value); + $this->recv_setMetaConf(); + } + + public function send_setMetaConf($key, $value) + { + $args = new \metastore\ThriftHiveMetastore_setMetaConf_args(); + $args->key = $key; + $args->value = $value; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'setMetaConf', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('setMetaConf', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_setMetaConf() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\metastore\ThriftHiveMetastore_setMetaConf_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new \metastore\ThriftHiveMetastore_setMetaConf_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->o1 !== null) { + throw $result->o1; + } + return; + } + public function create_database(\metastore\Database $database) { $this->send_create_database($database); @@ -6476,6 +6584,338 @@ class ThriftHiveMetastoreClient extends \FacebookServiceClient implements \metas // HELPER FUNCTIONS AND STRUCTURES +class ThriftHiveMetastore_getMetaConf_args { + static $_TSPEC; + + public $key = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'key', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['key'])) { + $this->key = $vals['key']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_getMetaConf_args'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->key); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_getMetaConf_args'); + if ($this->key !== null) { + $xfer += $output->writeFieldBegin('key', TType::STRING, 1); + $xfer += $output->writeString($this->key); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftHiveMetastore_getMetaConf_result { + static $_TSPEC; + + public $success = null; + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRING, + ), + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => '\metastore\MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_getMetaConf_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 0: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->success); + } else { + $xfer += $input->skip($ftype); + } + break; + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new \metastore\MetaException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_getMetaConf_result'); + if ($this->success !== null) { + $xfer += $output->writeFieldBegin('success', TType::STRING, 0); + $xfer += $output->writeString($this->success); + $xfer += $output->writeFieldEnd(); + } + if ($this->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftHiveMetastore_setMetaConf_args { + static $_TSPEC; + + public $key = null; + public $value = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'key', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'value', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['key'])) { + $this->key = $vals['key']; + } + if (isset($vals['value'])) { + $this->value = $vals['value']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_setMetaConf_args'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->key); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->value); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_setMetaConf_args'); + if ($this->key !== null) { + $xfer += $output->writeFieldBegin('key', TType::STRING, 1); + $xfer += $output->writeString($this->key); + $xfer += $output->writeFieldEnd(); + } + if ($this->value !== null) { + $xfer += $output->writeFieldBegin('value', TType::STRING, 2); + $xfer += $output->writeString($this->value); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftHiveMetastore_setMetaConf_result { + static $_TSPEC; + + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => '\metastore\MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_setMetaConf_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new \metastore\MetaException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_setMetaConf_result'); + if ($this->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class ThriftHiveMetastore_create_database_args { static $_TSPEC; diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote old mode 100644 new mode 100755 index 2874737..e430c77 --- metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote +++ metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote @@ -23,6 +23,8 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': 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.TBinaryProtocol(transport) 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) diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py index 2f2c34c..450018b 100644 --- metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py +++ metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py @@ -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.Client, Iface): 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 @@ def recv_show_compact(self, ): 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 @@ def process(self, iprot, oprot): 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 @@ def process_show_compact(self, seqid, iprot, oprot): # 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: diff --git metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb index 70b1418..74964b4 100644 --- metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb +++ metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb @@ -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 diff --git metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index 6e689d0..054a702 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -142,6 +142,7 @@ 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 static Integer get() { } 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 HiveConf getHiveConf() { } } - 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 @@ private boolean init() throws MetaException { 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 void setConf(Configuration conf) { 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 Warehouse getWh() { 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 void shutdown() { 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."); } @@ -4999,9 +5036,13 @@ public AggrStats get_aggr_stats_for(PartitionsStatsRequest request) } 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. diff --git metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index 85a77d9..237166e 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -173,7 +173,7 @@ public HiveMetaStoreClient(HiveConf conf, HiveMetaHookLoader hookLoader) 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 void close() { } } + @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 diff --git metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java index 1675751..cc7ae1d 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java @@ -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; } diff --git metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index 8746c37..143d1c7 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -77,17 +77,30 @@ 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 @@ * @throws MetaException * @throws TException */ - public List getDatabases(String databasePattern) - throws MetaException, TException; + List getDatabases(String databasePattern) throws MetaException, TException; /** * Get the names of all databases in the MetaStore. @@ -105,8 +117,7 @@ * @throws MetaException * @throws TException */ - public List getAllDatabases() - throws MetaException, TException; + List getAllDatabases() throws MetaException, TException; /** * Get the names of all tables in the specified database that satisfy the supplied @@ -118,7 +129,7 @@ * @throws TException * @throws UnknownDBException */ - public List getTables(String dbName, String tablePattern) + List getTables(String dbName, String tablePattern) throws MetaException, TException, UnknownDBException; /** @@ -129,8 +140,7 @@ * @throws TException * @throws UnknownDBException */ - public List getAllTables(String dbName) - throws MetaException, TException, UnknownDBException; + List getAllTables(String dbName) throws MetaException, TException, UnknownDBException; /** * Get a list of table names that match a filter. @@ -168,7 +178,7 @@ * The maximum number of tables returned * @return A list of table names that match the desired filter */ - public List listTableNamesByFilter(String dbName, String filter, short maxTables) + List listTableNamesByFilter(String dbName, String filter, short maxTables) throws MetaException, TException, InvalidOperationException, UnknownDBException; @@ -186,7 +196,7 @@ * @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 void dropTable(String dbname, String tableName, boolean deleteData, * 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 boolean tableExists(String databaseName, String tableName) throws MetaExc * 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 boolean tableExists(String tableName) throws MetaException, * 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 Table getTable(String tableName) throws MetaException, TException, * @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 Database getDatabase(String databaseName) * @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 Table getTable(String dbName, String tableName) throws MetaException, * @throws MetaException * Any other errors */ - public List getTableObjectsByName(String dbName, List tableNames) + List
getTableObjectsByName(String dbName, List tableNames) throws MetaException, InvalidOperationException, UnknownDBException, TException; /** @@ -317,11 +325,11 @@ public Table getTable(String dbName, String tableName) throws MetaException, * @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 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 Partition appendPartition(String tableName, String dbName, String name) * @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 Partition add_partition(Partition partition) * @throws TException * Thrift exception */ - public int add_partitions(List partitions) + int add_partitions(List partitions) throws InvalidObjectException, AlreadyExistsException, MetaException, TException; /** @@ -368,7 +375,7 @@ public int add_partitions(List partitions) * @param needResults Whether the results are needed * @return the partitions that were added, or null if !needResults */ - public List add_partitions( + List add_partitions( List partitions, boolean ifNotExists, boolean needResults) throws InvalidObjectException, AlreadyExistsException, MetaException, TException; @@ -382,7 +389,7 @@ public int add_partitions(List partitions) * @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 partVals) throws NoSuchObjectException, MetaException, TException; /** @@ -393,7 +400,7 @@ public Partition getPartition(String tblName, String dbName, * @param destTableName * @return partition object */ - public Partition exchange_partition(Map partitionSpecs, + Partition exchange_partition(Map partitionSpecs, String sourceDb, String sourceTable, String destdb, String destTableName) throws MetaException, NoSuchObjectException, InvalidObjectException, TException; @@ -408,7 +415,7 @@ public Partition exchange_partition(Map partitionSpecs, * @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 Partition getPartition(String dbName, String tblName, * @throws NoSuchObjectException * @throws TException */ - public Partition getPartitionWithAuthInfo(String dbName, String tableName, + Partition getPartitionWithAuthInfo(String dbName, String tableName, List pvals, String userName, List groupNames) throws MetaException, UnknownTableException, NoSuchObjectException, TException; @@ -437,16 +444,16 @@ public Partition getPartitionWithAuthInfo(String dbName, String tableName, * @throws MetaException * @throws TException */ - public List listPartitions(String db_name, String tbl_name, + List listPartitions(String db_name, String tbl_name, short max_parts) throws NoSuchObjectException, MetaException, TException; - public List listPartitions(String db_name, String tbl_name, + List listPartitions(String db_name, String tbl_name, List part_vals, short max_parts) throws NoSuchObjectException, MetaException, TException; - public List listPartitionNames(String db_name, String tbl_name, + List listPartitionNames(String db_name, String tbl_name, short max_parts) throws MetaException, TException; - public List listPartitionNames(String db_name, String tbl_name, + List listPartitionNames(String db_name, String tbl_name, List part_vals, short max_parts) throws MetaException, TException, NoSuchObjectException; @@ -464,7 +471,7 @@ public Partition getPartitionWithAuthInfo(String dbName, String tableName, * @throws NoSuchObjectException * @throws TException */ - public List listPartitionsByFilter(String db_name, String tbl_name, + List listPartitionsByFilter(String db_name, String tbl_name, String filter, short max_parts) throws MetaException, NoSuchObjectException, TException; @@ -481,7 +488,7 @@ public Partition getPartitionWithAuthInfo(String dbName, String tableName, * @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 result) throws TException; @@ -494,7 +501,7 @@ public boolean listPartitionsByExpr(String db_name, String tbl_name, * @return the list of partitions * @throws NoSuchObjectException */ - public List listPartitionsWithAuthInfo(String dbName, + List listPartitionsWithAuthInfo(String dbName, String tableName, short s, String userName, List groupNames) throws MetaException, TException, NoSuchObjectException; @@ -508,7 +515,7 @@ public boolean listPartitionsByExpr(String db_name, String tbl_name, * @throws MetaException * @throws TException */ - public List getPartitionsByNames(String db_name, String tbl_name, + List getPartitionsByNames(String db_name, String tbl_name, List part_names) throws NoSuchObjectException, MetaException, TException; /** @@ -521,7 +528,7 @@ public boolean listPartitionsByExpr(String db_name, String tbl_name, * @return the list of paritions * @throws NoSuchObjectException */ - public List listPartitionsWithAuthInfo(String dbName, + List listPartitionsWithAuthInfo(String dbName, String tableName, List partialPvals, short s, String userName, List groupNames) throws MetaException, TException, NoSuchObjectException; @@ -538,7 +545,7 @@ public boolean listPartitionsByExpr(String db_name, String tbl_name, * @throws UnknownPartitionException * @throws InvalidPartitionException */ - public void markPartitionForEvent(String db_name, String tbl_name, Map partKVs, + void markPartitionForEvent(String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; @@ -555,7 +562,7 @@ public void markPartitionForEvent(String db_name, String tbl_name, Map partKVs, + boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; @@ -564,9 +571,7 @@ public boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map partVals) - throws TException, MetaException; - + void validatePartitionNameCharacters(List partVals) throws TException, MetaException; /** * @param tbl @@ -578,25 +583,25 @@ public void validatePartitionNameCharacters(List partVals) * @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 void alterDatabase(String name, Database db) * @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 part_vals, boolean deleteData) throws NoSuchObjectException, MetaException, TException; @@ -620,7 +625,7 @@ public boolean dropPartition(String db_name, String tbl_name, List> 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 boolean dropPartition(String db_name, String tbl_name, * @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 void alter_partition(String dbName, String tblName, Partition newPart) * @throws TException * if error in communicating with metastore server */ - public void alter_partitions(String dbName, String tblName, List newParts) + void alter_partitions(String dbName, String tblName, List newParts) throws InvalidOperationException, MetaException, TException; /** @@ -679,7 +684,7 @@ public void alter_partitions(String dbName, String tblName, List newP * @throws TException * if error in communicating with metastore server */ - public void renamePartition(final String dbname, final String name, final List part_vals, final Partition newPart) + void renamePartition(final String dbname, final String name, final List part_vals, final Partition newPart) throws InvalidOperationException, MetaException, TException; /** @@ -692,7 +697,7 @@ public void renamePartition(final String dbname, final String name, final List getFields(String db, String tableName) + List getFields(String db, String tableName) throws MetaException, TException, UnknownTableException, UnknownDBException; @@ -706,7 +711,7 @@ public void renamePartition(final String dbname, final String name, final List getSchema(String db, String tableName) + List getSchema(String db, String tableName) throws MetaException, TException, UnknownTableException, UnknownDBException; @@ -719,7 +724,7 @@ public void renamePartition(final String dbname, final String name, final List partitionNameToVals(String name) + List partitionNameToVals(String name) throws MetaException, TException; /** * @@ -740,7 +745,7 @@ public String getConfigValue(String name, String defaultValue) * @throws MetaException * @throws TException */ - public Map partitionNameToSpec(String name) + Map partitionNameToSpec(String name) throws MetaException, TException; /** @@ -752,10 +757,10 @@ public String getConfigValue(String name, String defaultValue) * @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 void alter_index(String dbName, String tblName, String indexName, * @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 Index getIndex(String dbName, String tblName, String indexName) * @throws MetaException * @throws TException */ - public List listIndexes(String db_name, String tbl_name, + List listIndexes(String db_name, String tbl_name, short max) throws NoSuchObjectException, MetaException, TException; /** @@ -797,7 +802,7 @@ public Index getIndex(String dbName, String tblName, String indexName) * @throws MetaException * @throws TException */ - public List listIndexNames(String db_name, String tbl_name, + List listIndexNames(String db_name, String tbl_name, short max) throws MetaException, TException; /** @@ -810,7 +815,7 @@ public Index getIndex(String dbName, String tblName, String indexName) * @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 boolean dropIndex(String db_name, String tbl_name, * @throws InvalidInputException */ - public boolean updateTableColumnStatistics(ColumnStatistics statsObj) + boolean updateTableColumnStatistics(ColumnStatistics statsObj) throws NoSuchObjectException, InvalidObjectException, MetaException, TException, InvalidInputException; @@ -840,7 +845,7 @@ public boolean updateTableColumnStatistics(ColumnStatistics statsObj) * @throws InvalidInputException */ - public boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) + boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) throws NoSuchObjectException, InvalidObjectException, MetaException, TException, InvalidInputException; @@ -848,14 +853,14 @@ public boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) * Get table column statistics given dbName, tableName and multiple colName-s * @return ColumnStatistics struct for a given db, table and columns */ - public List getTableColumnStatistics(String dbName, String tableName, + List getTableColumnStatistics(String dbName, String tableName, List 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> getPartitionColumnStatistics(String dbName, + Map> getPartitionColumnStatistics(String dbName, String tableName, List partNames, List colNames) throws NoSuchObjectException, MetaException, TException; @@ -873,24 +878,23 @@ public boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) * @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 boolean deleteTableColumnStatistics(String dbName, String tableName, Stri * @throws MetaException * @throws TException */ - public boolean create_role(Role role) + boolean create_role(Role role) throws MetaException, TException; /** @@ -911,7 +915,7 @@ public boolean create_role(Role role) * @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 boolean create_role(Role role) * @throws TException * @throws MetaException */ - public List listRoleNames() throws MetaException, TException; + List listRoleNames() throws MetaException, TException; /** * @@ -933,7 +937,7 @@ public boolean create_role(Role role) * @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 boolean grant_role(String role_name, String user_name, * @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 boolean revoke_role(String role_name, String user_name, * @throws MetaException * @throws TException */ - public List list_roles(String principalName, PrincipalType principalType) + List list_roles(String principalName, PrincipalType principalType) throws MetaException, TException; /** @@ -972,7 +976,7 @@ public boolean revoke_role(String role_name, String user_name, * @throws MetaException * @throws TException */ - public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, + PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, String user_name, List group_names) throws MetaException, TException; @@ -985,7 +989,7 @@ public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, * @throws MetaException * @throws TException */ - public List list_privileges(String principal_name, + List list_privileges(String principal_name, PrincipalType principal_type, HiveObjectRef hiveObject) throws MetaException, TException; @@ -995,7 +999,7 @@ public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, * @throws MetaException * @throws TException */ - public boolean grant_privileges(PrivilegeBag privileges) + boolean grant_privileges(PrivilegeBag privileges) throws MetaException, TException; /** @@ -1004,7 +1008,7 @@ public boolean grant_privileges(PrivilegeBag privileges) * @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 boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption) * @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 String getDelegationToken(String owner, String renewerKerberosPrincipalNa * @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 getFunctions(String dbName, String pattern) + List getFunctions(String dbName, String pattern) throws MetaException, TException; /** @@ -1052,7 +1056,7 @@ public Function getFunction(String dbName, String funcName) * @return list of valid transactions * @throws TException */ - public ValidTxnList getValidTxns() throws TException; + ValidTxnList getValidTxns() throws TException; /** * Initiate a transaction. @@ -1062,7 +1066,7 @@ public Function getFunction(String dbName, String funcName) * @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 Function getFunction(String dbName, String funcName) * 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 Function getFunction(String dbName, String funcName) * 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 Function getFunction(String dbName, String funcName) * 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 void commitTxn(long txnid) * @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 void commitTxn(long txnid) * 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 LockResponse lock(LockRequest request) * 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 LockResponse checkLock(long lockid) * transaction. * @throws TException */ - public void unlock(long lockid) + void unlock(long lockid) throws NoSuchLockException, TxnOpenException, TException; /** @@ -1200,7 +1204,7 @@ public void unlock(long lockid) * @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 void unlock(long lockid) * 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 void heartbeat(long txnid, long lockid) * 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 void heartbeat(long txnid, long lockid) * @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 void compact(String dbname, String tableName, String partitionName, Comp * 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); } } diff --git metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java index c28c46a..ec1dca2 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java @@ -24,6 +24,7 @@ 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 MetaStoreEventListener(Configuration config){ * @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 { } diff --git metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java index 86172b9..84e6dcd 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java @@ -43,44 +43,40 @@ 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 Object invoke(final Object proxy, final Method method, final Object[] arg } 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 Object invoke(final Object proxy, final Method method, final Object[] arg gotNewConnectUrl = MetaStoreInit.updateConnectionURL(hiveConf, getConf(), lastUrl, metaStoreInitData); } - return ret; } public Configuration getConf() { - return hiveConf; + return configuration; } } diff --git metastore/src/java/org/apache/hadoop/hive/metastore/events/ConfigChangeEvent.java metastore/src/java/org/apache/hadoop/hive/metastore/events/ConfigChangeEvent.java new file mode 100644 index 0000000..e06b960 --- /dev/null +++ metastore/src/java/org/apache/hadoop/hive/metastore/events/ConfigChangeEvent.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.metastore.events; + +import org.apache.hadoop.hive.metastore.HiveMetaStore; + +public class ConfigChangeEvent extends ListenerEvent { + + private final String key; + private final String oldValue; + private final String newValue; + + public ConfigChangeEvent(HiveMetaStore.HMSHandler handler, String key, + String oldValue, String newValue) { + super(true, handler); + this.key = key; + this.oldValue = oldValue; + this.newValue = newValue; + } + + public String getKey() { + return key; + } + + public String getOldValue() { + return oldValue; + } + + public String getNewValue() { + return newValue; + } +} diff --git metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java index 92f2388..37daf52 100644 --- metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java +++ metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java @@ -26,6 +26,7 @@ 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 DummyListener(Configuration config) { } @Override + public void onConfigChange(ConfigChangeEvent configChange) { + notifyList.add(configChange); + } + + @Override public void onAddPartition(AddPartitionEvent partition) throws MetaException { notifyList.add(partition); } diff --git ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java index 39b032e..5793b77 100644 --- ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java +++ ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java @@ -2719,4 +2719,19 @@ public Function getFunction(String dbName, String funcName) throws HiveException } } + public void setMetaConf(String propName, String propValue) throws HiveException { + try { + getMSC().setMetaConf(propName, propValue); + } catch (TException te) { + throw new HiveException(te); + } + } + + public String getMetaConf(String propName) throws HiveException { + try { + return getMSC().getMetaConf(propName); + } catch (TException te) { + throw new HiveException(te); + } + } }; diff --git ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java index 2baa24a..bc9254c 100644 --- ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java +++ ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java @@ -32,6 +32,7 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.Schema; +import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.parse.VariableSubstitution; import org.apache.hadoop.hive.ql.session.SessionState; @@ -104,11 +105,12 @@ public CommandProcessorResponse executeSetVariable(String varname, String varval try { return new CommandProcessorResponse(setVariable(varname, varvalue)); } catch (Exception e) { - return new CommandProcessorResponse(1, e.getMessage(), "42000"); + return new CommandProcessorResponse(1, e.getMessage(), "42000", + e instanceof IllegalArgumentException ? null : e); } } - public static int setVariable(String varname, String varvalue) throws IllegalArgumentException { + public static int setVariable(String varname, String varvalue) throws Exception { SessionState ss = SessionState.get(); if (varvalue.contains("\n")){ ss.err.println("Warning: Value had a \\n character in it."); @@ -126,6 +128,10 @@ public static int setVariable(String varname, String varvalue) throws IllegalArg } else if (varname.startsWith(HIVEVAR_PREFIX)) { String propName = varname.substring(HIVEVAR_PREFIX.length()); ss.getHiveVariables().put(propName, new VariableSubstitution().substitute(ss.getConf(),varvalue)); + } else if (varname.startsWith(METACONF_PREFIX)) { + String propName = varname.substring(METACONF_PREFIX.length()); + Hive hive = Hive.get(ss.getConf()); + hive.setMetaConf(propName, new VariableSubstitution().substitute(ss.getConf(), varvalue)); } else { setConf(varname, varname, varvalue, true); } @@ -178,8 +184,7 @@ private static void setConf(String varname, String key, String varvalue, boolean return sortedEnvMap; } - - private CommandProcessorResponse getVariable(String varname) { + private CommandProcessorResponse getVariable(String varname) throws Exception { SessionState ss = SessionState.get(); if (varname.equals("silent")){ ss.out.println("silent" + "=" + ss.getIsSilent()); @@ -222,6 +227,17 @@ private CommandProcessorResponse getVariable(String varname) { ss.out.println(varname + " is undefined as a hive variable"); return new CommandProcessorResponse(1); } + } else if (varname.indexOf(METACONF_PREFIX) == 0) { + String var = varname.substring(METACONF_PREFIX.length()); + Hive hive = Hive.get(ss.getConf()); + String value = hive.getMetaConf(var); + if (value != null) { + ss.out.println(METACONF_PREFIX + var + "=" + value); + return createProcessorSuccessResponse(); + } else { + ss.out.println(varname + " is undefined as a hive meta variable"); + return new CommandProcessorResponse(1); + } } else { dumpOption(varname); return createProcessorSuccessResponse(); @@ -263,10 +279,12 @@ public CommandProcessorResponse run(String command) { return new CommandProcessorResponse(0); } return executeSetVariable(part[0],part[1]); - } else { + } + try { return getVariable(nwcmd); + } catch (Exception e) { + return new CommandProcessorResponse(1, e.getMessage(), "42000", e); } - } // create a Schema object containing the give column diff --git ql/src/test/queries/clientpositive/set_metaconf.q ql/src/test/queries/clientpositive/set_metaconf.q new file mode 100644 index 0000000..ede3c02 --- /dev/null +++ ql/src/test/queries/clientpositive/set_metaconf.q @@ -0,0 +1,5 @@ +set metaconf:hive.metastore.try.direct.sql; + +set metaconf:hive.metastore.try.direct.sql=false; +set metaconf:hive.metastore.try.direct.sql; +set hive.metastore.try.direct.sql; diff --git ql/src/test/results/clientpositive/set_metaconf.q.out ql/src/test/results/clientpositive/set_metaconf.q.out new file mode 100644 index 0000000..ec33e59 --- /dev/null +++ ql/src/test/results/clientpositive/set_metaconf.q.out @@ -0,0 +1,3 @@ +metaconf:hive.metastore.try.direct.sql=true +metaconf:hive.metastore.try.direct.sql=false +hive.metastore.try.direct.sql=true diff --git service/src/java/org/apache/hive/service/cli/session/HiveSessionBase.java service/src/java/org/apache/hive/service/cli/session/HiveSessionBase.java index 4c3164e..eee1cc6 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSessionBase.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSessionBase.java @@ -55,7 +55,7 @@ * Initialize the session * @param sessionConfMap */ - public void initialize(Map sessionConfMap); + public void initialize(Map sessionConfMap) throws Exception; public SessionHandle getSessionHandle(); diff --git service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java index b39d64d..bc0a02c 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java @@ -110,7 +110,7 @@ public HiveSessionImpl(TProtocolVersion protocol, String username, String passwo } @Override - public void initialize(Map sessionConfMap) { + public void initialize(Map sessionConfMap) throws Exception { //process global init file: .hiverc processGlobalInitFile(); SessionState.setCurrentSessionState(sessionState); @@ -168,7 +168,7 @@ private void processGlobalInitFile() { } } - private void configureSession(Map sessionConfMap) { + private void configureSession(Map sessionConfMap) throws Exception { for (Map.Entry entry : sessionConfMap.entrySet()) { String key = entry.getKey(); if (key.startsWith("set:")) { diff --git service/src/java/org/apache/hive/service/cli/session/SessionManager.java service/src/java/org/apache/hive/service/cli/session/SessionManager.java index c2f0495..d573592 100644 --- service/src/java/org/apache/hive/service/cli/session/SessionManager.java +++ service/src/java/org/apache/hive/service/cli/session/SessionManager.java @@ -34,7 +34,6 @@ import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hive.service.CompositeService; -import org.apache.hive.service.auth.TSetIpAddressProcessor; import org.apache.hive.service.cli.HiveSQLException; import org.apache.hive.service.cli.SessionHandle; import org.apache.hive.service.cli.operation.OperationManager; @@ -131,15 +130,20 @@ public SessionHandle openSession(TProtocolVersion protocol, String username, Str } session.setSessionManager(this); session.setOperationManager(operationManager); - session.initialize(sessionConf); - session.open(); - handleToSession.put(session.getSessionHandle(), session); - + try { + session.initialize(sessionConf); + session.open(); + } catch (Exception e) { + throw new HiveSQLException("Failed to open new session", e); + } try { executeSessionHooks(session); } catch (Exception e) { throw new HiveSQLException("Failed to execute session hooks", e); } + + handleToSession.put(session.getSessionHandle(), session); + return session.getSessionHandle(); }