diff --git a/metastore/if/hive_metastore.thrift b/metastore/if/hive_metastore.thrift index acebf7a..4aba677 100755 --- a/metastore/if/hive_metastore.thrift +++ b/metastore/if/hive_metastore.thrift @@ -993,6 +993,9 @@ service ThriftHiveMetastore extends fb303.FacebookService throws (1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3, 4:NoSuchObjectException o4) + void drop_constraint(1:string dbname, 2:string tablename, 3:string constraintname) + throws(1:NoSuchObjectException o1, 2:MetaException o3) + // drops the table and all the partitions associated with it if the table has partitions // delete data (including partitions) if deleteData is set to true void drop_table(1:string dbname, 2:string name, 3:bool deleteData) diff --git a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp index 690c895..de244d5 100644 --- a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp +++ b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp @@ -4816,6 +4816,245 @@ uint32_t ThriftHiveMetastore_create_table_with_constraints_presult::read(::apach } +ThriftHiveMetastore_drop_constraint_args::~ThriftHiveMetastore_drop_constraint_args() throw() { +} + + +uint32_t ThriftHiveMetastore_drop_constraint_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*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->dbname); + this->__isset.dbname = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->tablename); + this->__isset.tablename = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->constraintname); + this->__isset.constraintname = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_drop_constraint_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftHiveMetastore_drop_constraint_args"); + + xfer += oprot->writeFieldBegin("dbname", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->dbname); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("tablename", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->tablename); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("constraintname", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->constraintname); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftHiveMetastore_drop_constraint_pargs::~ThriftHiveMetastore_drop_constraint_pargs() throw() { +} + + +uint32_t ThriftHiveMetastore_drop_constraint_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftHiveMetastore_drop_constraint_pargs"); + + xfer += oprot->writeFieldBegin("dbname", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->dbname))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("tablename", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString((*(this->tablename))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("constraintname", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString((*(this->constraintname))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftHiveMetastore_drop_constraint_result::~ThriftHiveMetastore_drop_constraint_result() throw() { +} + + +uint32_t ThriftHiveMetastore_drop_constraint_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*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; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o3.read(iprot); + this->__isset.o3 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_drop_constraint_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftHiveMetastore_drop_constraint_result"); + + if (this->__isset.o1) { + xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->o1.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.o3) { + xfer += oprot->writeFieldBegin("o3", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->o3.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftHiveMetastore_drop_constraint_presult::~ThriftHiveMetastore_drop_constraint_presult() throw() { +} + + +uint32_t ThriftHiveMetastore_drop_constraint_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*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; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o3.read(iprot); + this->__isset.o3 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + + ThriftHiveMetastore_drop_table_args::~ThriftHiveMetastore_drop_table_args() throw() { } @@ -37664,6 +37903,67 @@ void ThriftHiveMetastoreClient::recv_create_table_with_constraints() return; } +void ThriftHiveMetastoreClient::drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname) +{ + send_drop_constraint(dbname, tablename, constraintname); + recv_drop_constraint(); +} + +void ThriftHiveMetastoreClient::send_drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("drop_constraint", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_drop_constraint_pargs args; + args.dbname = &dbname; + args.tablename = &tablename; + args.constraintname = &constraintname; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void ThriftHiveMetastoreClient::recv_drop_constraint() +{ + + 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("drop_constraint") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + ThriftHiveMetastore_drop_constraint_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.o1) { + throw result.o1; + } + if (result.__isset.o3) { + throw result.o3; + } + return; +} + void ThriftHiveMetastoreClient::drop_table(const std::string& dbname, const std::string& name, const bool deleteData) { send_drop_table(dbname, name, deleteData); @@ -46883,6 +47183,65 @@ void ThriftHiveMetastoreProcessor::process_create_table_with_constraints(int32_t } } +void ThriftHiveMetastoreProcessor::process_drop_constraint(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.drop_constraint", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftHiveMetastore.drop_constraint"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftHiveMetastore.drop_constraint"); + } + + ThriftHiveMetastore_drop_constraint_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftHiveMetastore.drop_constraint", bytes); + } + + ThriftHiveMetastore_drop_constraint_result result; + try { + iface_->drop_constraint(args.dbname, args.tablename, args.constraintname); + } catch (NoSuchObjectException &o1) { + result.o1 = o1; + result.__isset.o1 = true; + } catch (MetaException &o3) { + result.o3 = o3; + result.__isset.o3 = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftHiveMetastore.drop_constraint"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("drop_constraint", ::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.drop_constraint"); + } + + oprot->writeMessageBegin("drop_constraint", ::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.drop_constraint", bytes); + } +} + void ThriftHiveMetastoreProcessor::process_drop_table(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) { void* ctx = NULL; @@ -56131,6 +56490,94 @@ void ThriftHiveMetastoreConcurrentClient::recv_create_table_with_constraints(con } // end while(true) } +void ThriftHiveMetastoreConcurrentClient::drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname) +{ + int32_t seqid = send_drop_constraint(dbname, tablename, constraintname); + recv_drop_constraint(seqid); +} + +int32_t ThriftHiveMetastoreConcurrentClient::send_drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("drop_constraint", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_drop_constraint_pargs args; + args.dbname = &dbname; + args.tablename = &tablename; + args.constraintname = &constraintname; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void ThriftHiveMetastoreConcurrentClient::recv_drop_constraint(const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("drop_constraint") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + ThriftHiveMetastore_drop_constraint_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.o1) { + sentry.commit(); + throw result.o1; + } + if (result.__isset.o3) { + sentry.commit(); + throw result.o3; + } + sentry.commit(); + return; + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + void ThriftHiveMetastoreConcurrentClient::drop_table(const std::string& dbname, const std::string& name, const bool deleteData) { int32_t seqid = send_drop_table(dbname, name, deleteData); diff --git a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h index 11d3322..a888f9e 100644 --- a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h +++ b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h @@ -41,6 +41,7 @@ class ThriftHiveMetastoreIf : virtual public ::facebook::fb303::FacebookService virtual void create_table(const Table& tbl) = 0; virtual void create_table_with_environment_context(const Table& tbl, const EnvironmentContext& environment_context) = 0; virtual void create_table_with_constraints(const Table& tbl, const std::vector & primaryKeys, const std::vector & foreignKeys) = 0; + virtual void drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname) = 0; virtual void drop_table(const std::string& dbname, const std::string& name, const bool deleteData) = 0; virtual void drop_table_with_environment_context(const std::string& dbname, const std::string& name, const bool deleteData, const EnvironmentContext& environment_context) = 0; virtual void get_tables(std::vector & _return, const std::string& db_name, const std::string& pattern) = 0; @@ -256,6 +257,9 @@ class ThriftHiveMetastoreNull : virtual public ThriftHiveMetastoreIf , virtual p void create_table_with_constraints(const Table& /* tbl */, const std::vector & /* primaryKeys */, const std::vector & /* foreignKeys */) { return; } + void drop_constraint(const std::string& /* dbname */, const std::string& /* tablename */, const std::string& /* constraintname */) { + return; + } void drop_table(const std::string& /* dbname */, const std::string& /* name */, const bool /* deleteData */) { return; } @@ -3032,6 +3036,132 @@ class ThriftHiveMetastore_create_table_with_constraints_presult { }; +typedef struct _ThriftHiveMetastore_drop_constraint_args__isset { + _ThriftHiveMetastore_drop_constraint_args__isset() : dbname(false), tablename(false), constraintname(false) {} + bool dbname :1; + bool tablename :1; + bool constraintname :1; +} _ThriftHiveMetastore_drop_constraint_args__isset; + +class ThriftHiveMetastore_drop_constraint_args { + public: + + ThriftHiveMetastore_drop_constraint_args(const ThriftHiveMetastore_drop_constraint_args&); + ThriftHiveMetastore_drop_constraint_args& operator=(const ThriftHiveMetastore_drop_constraint_args&); + ThriftHiveMetastore_drop_constraint_args() : dbname(), tablename(), constraintname() { + } + + virtual ~ThriftHiveMetastore_drop_constraint_args() throw(); + std::string dbname; + std::string tablename; + std::string constraintname; + + _ThriftHiveMetastore_drop_constraint_args__isset __isset; + + void __set_dbname(const std::string& val); + + void __set_tablename(const std::string& val); + + void __set_constraintname(const std::string& val); + + bool operator == (const ThriftHiveMetastore_drop_constraint_args & rhs) const + { + if (!(dbname == rhs.dbname)) + return false; + if (!(tablename == rhs.tablename)) + return false; + if (!(constraintname == rhs.constraintname)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_drop_constraint_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_drop_constraint_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftHiveMetastore_drop_constraint_pargs { + public: + + + virtual ~ThriftHiveMetastore_drop_constraint_pargs() throw(); + const std::string* dbname; + const std::string* tablename; + const std::string* constraintname; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_drop_constraint_result__isset { + _ThriftHiveMetastore_drop_constraint_result__isset() : o1(false), o3(false) {} + bool o1 :1; + bool o3 :1; +} _ThriftHiveMetastore_drop_constraint_result__isset; + +class ThriftHiveMetastore_drop_constraint_result { + public: + + ThriftHiveMetastore_drop_constraint_result(const ThriftHiveMetastore_drop_constraint_result&); + ThriftHiveMetastore_drop_constraint_result& operator=(const ThriftHiveMetastore_drop_constraint_result&); + ThriftHiveMetastore_drop_constraint_result() { + } + + virtual ~ThriftHiveMetastore_drop_constraint_result() throw(); + NoSuchObjectException o1; + MetaException o3; + + _ThriftHiveMetastore_drop_constraint_result__isset __isset; + + void __set_o1(const NoSuchObjectException& val); + + void __set_o3(const MetaException& val); + + bool operator == (const ThriftHiveMetastore_drop_constraint_result & rhs) const + { + if (!(o1 == rhs.o1)) + return false; + if (!(o3 == rhs.o3)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_drop_constraint_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_drop_constraint_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_drop_constraint_presult__isset { + _ThriftHiveMetastore_drop_constraint_presult__isset() : o1(false), o3(false) {} + bool o1 :1; + bool o3 :1; +} _ThriftHiveMetastore_drop_constraint_presult__isset; + +class ThriftHiveMetastore_drop_constraint_presult { + public: + + + virtual ~ThriftHiveMetastore_drop_constraint_presult() throw(); + NoSuchObjectException o1; + MetaException o3; + + _ThriftHiveMetastore_drop_constraint_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + typedef struct _ThriftHiveMetastore_drop_table_args__isset { _ThriftHiveMetastore_drop_table_args__isset() : dbname(false), name(false), deleteData(false) {} bool dbname :1; @@ -18851,6 +18981,9 @@ class ThriftHiveMetastoreClient : virtual public ThriftHiveMetastoreIf, public void create_table_with_constraints(const Table& tbl, const std::vector & primaryKeys, const std::vector & foreignKeys); void send_create_table_with_constraints(const Table& tbl, const std::vector & primaryKeys, const std::vector & foreignKeys); void recv_create_table_with_constraints(); + void drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname); + void send_drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname); + void recv_drop_constraint(); void drop_table(const std::string& dbname, const std::string& name, const bool deleteData); void send_drop_table(const std::string& dbname, const std::string& name, const bool deleteData); void recv_drop_table(); @@ -19261,6 +19394,7 @@ class ThriftHiveMetastoreProcessor : public ::facebook::fb303::FacebookServiceP void process_create_table(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_create_table_with_environment_context(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_create_table_with_constraints(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_drop_constraint(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_drop_table(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_drop_table_with_environment_context(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_tables(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); @@ -19411,6 +19545,7 @@ class ThriftHiveMetastoreProcessor : public ::facebook::fb303::FacebookServiceP processMap_["create_table"] = &ThriftHiveMetastoreProcessor::process_create_table; processMap_["create_table_with_environment_context"] = &ThriftHiveMetastoreProcessor::process_create_table_with_environment_context; processMap_["create_table_with_constraints"] = &ThriftHiveMetastoreProcessor::process_create_table_with_constraints; + processMap_["drop_constraint"] = &ThriftHiveMetastoreProcessor::process_drop_constraint; processMap_["drop_table"] = &ThriftHiveMetastoreProcessor::process_drop_table; processMap_["drop_table_with_environment_context"] = &ThriftHiveMetastoreProcessor::process_drop_table_with_environment_context; processMap_["get_tables"] = &ThriftHiveMetastoreProcessor::process_get_tables; @@ -19752,6 +19887,15 @@ class ThriftHiveMetastoreMultiface : virtual public ThriftHiveMetastoreIf, publi ifaces_[i]->create_table_with_constraints(tbl, primaryKeys, foreignKeys); } + void drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->drop_constraint(dbname, tablename, constraintname); + } + ifaces_[i]->drop_constraint(dbname, tablename, constraintname); + } + void drop_table(const std::string& dbname, const std::string& name, const bool deleteData) { size_t sz = ifaces_.size(); size_t i = 0; @@ -21045,6 +21189,9 @@ class ThriftHiveMetastoreConcurrentClient : virtual public ThriftHiveMetastoreIf void create_table_with_constraints(const Table& tbl, const std::vector & primaryKeys, const std::vector & foreignKeys); int32_t send_create_table_with_constraints(const Table& tbl, const std::vector & primaryKeys, const std::vector & foreignKeys); void recv_create_table_with_constraints(const int32_t seqid); + void drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname); + int32_t send_drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname); + void recv_drop_constraint(const int32_t seqid); void drop_table(const std::string& dbname, const std::string& name, const bool deleteData); int32_t send_drop_table(const std::string& dbname, const std::string& name, const bool deleteData); void recv_drop_table(const int32_t seqid); diff --git a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp index fa87e34..1542998 100644 --- a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp +++ b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp @@ -117,6 +117,11 @@ class ThriftHiveMetastoreHandler : virtual public ThriftHiveMetastoreIf { printf("create_table_with_constraints\n"); } + void drop_constraint(const std::string& dbname, const std::string& tablename, const std::string& constraintname) { + // Your implementation goes here + printf("drop_constraint\n"); + } + void drop_table(const std::string& dbname, const std::string& name, const bool deleteData) { // Your implementation goes here printf("drop_table\n"); diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java index 051c1f2..1456b20 100644 --- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java +++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java @@ -80,6 +80,8 @@ public void create_table_with_constraints(Table tbl, List primaryKeys, List foreignKeys) throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, org.apache.thrift.TException; + public void drop_constraint(String dbname, String tablename, String constraintname) throws NoSuchObjectException, MetaException, org.apache.thrift.TException; + public void drop_table(String dbname, String name, boolean deleteData) throws NoSuchObjectException, MetaException, org.apache.thrift.TException; public void drop_table_with_environment_context(String dbname, String name, boolean deleteData, EnvironmentContext environment_context) throws NoSuchObjectException, MetaException, org.apache.thrift.TException; @@ -376,6 +378,8 @@ public void create_table_with_constraints(Table tbl, List primaryKeys, List foreignKeys, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void drop_constraint(String dbname, String tablename, String constraintname, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void drop_table(String dbname, String name, boolean deleteData, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void drop_table_with_environment_context(String dbname, String name, boolean deleteData, EnvironmentContext environment_context, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -1218,6 +1222,34 @@ public void recv_create_table_with_constraints() throws AlreadyExistsException, return; } + public void drop_constraint(String dbname, String tablename, String constraintname) throws NoSuchObjectException, MetaException, org.apache.thrift.TException + { + send_drop_constraint(dbname, tablename, constraintname); + recv_drop_constraint(); + } + + public void send_drop_constraint(String dbname, String tablename, String constraintname) throws org.apache.thrift.TException + { + drop_constraint_args args = new drop_constraint_args(); + args.setDbname(dbname); + args.setTablename(tablename); + args.setConstraintname(constraintname); + sendBase("drop_constraint", args); + } + + public void recv_drop_constraint() throws NoSuchObjectException, MetaException, org.apache.thrift.TException + { + drop_constraint_result result = new drop_constraint_result(); + receiveBase(result, "drop_constraint"); + if (result.o1 != null) { + throw result.o1; + } + if (result.o3 != null) { + throw result.o3; + } + return; + } + public void drop_table(String dbname, String name, boolean deleteData) throws NoSuchObjectException, MetaException, org.apache.thrift.TException { send_drop_table(dbname, name, deleteData); @@ -5535,6 +5567,44 @@ public void getResult() throws AlreadyExistsException, InvalidObjectException, M } } + public void drop_constraint(String dbname, String tablename, String constraintname, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + drop_constraint_call method_call = new drop_constraint_call(dbname, tablename, constraintname, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class drop_constraint_call extends org.apache.thrift.async.TAsyncMethodCall { + private String dbname; + private String tablename; + private String constraintname; + public drop_constraint_call(String dbname, String tablename, String constraintname, 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.dbname = dbname; + this.tablename = tablename; + this.constraintname = constraintname; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("drop_constraint", org.apache.thrift.protocol.TMessageType.CALL, 0)); + drop_constraint_args args = new drop_constraint_args(); + args.setDbname(dbname); + args.setTablename(tablename); + args.setConstraintname(constraintname); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws NoSuchObjectException, 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_drop_constraint(); + } + } + public void drop_table(String dbname, String name, boolean deleteData, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); drop_table_call method_call = new drop_table_call(dbname, name, deleteData, resultHandler, this, ___protocolFactory, ___transport); @@ -10078,6 +10148,7 @@ protected Processor(I iface, Map extends org.apache.thrift.ProcessFunction { + public drop_constraint() { + super("drop_constraint"); + } + + public drop_constraint_args getEmptyArgsInstance() { + return new drop_constraint_args(); + } + + protected boolean isOneway() { + return false; + } + + public drop_constraint_result getResult(I iface, drop_constraint_args args) throws org.apache.thrift.TException { + drop_constraint_result result = new drop_constraint_result(); + try { + iface.drop_constraint(args.dbname, args.tablename, args.constraintname); + } catch (NoSuchObjectException o1) { + result.o1 = o1; + } catch (MetaException o3) { + result.o3 = o3; + } + return result; + } + } + public static class drop_table extends org.apache.thrift.ProcessFunction { public drop_table() { super("drop_table"); @@ -13964,6 +14061,7 @@ protected AsyncProcessor(I iface, Map extends org.apache.thrift.AsyncProcessFunction { - public drop_table() { - super("drop_table"); + public static class drop_constraint extends org.apache.thrift.AsyncProcessFunction { + public drop_constraint() { + super("drop_constraint"); } - public drop_table_args getEmptyArgsInstance() { - return new drop_table_args(); + public drop_constraint_args getEmptyArgsInstance() { + return new drop_constraint_args(); } public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback() { public void onComplete(Void o) { - drop_table_result result = new drop_table_result(); + drop_constraint_result result = new drop_constraint_result(); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -15332,7 +15430,7 @@ public void onComplete(Void o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - drop_table_result result = new drop_table_result(); + drop_constraint_result result = new drop_constraint_result(); if (e instanceof NoSuchObjectException) { result.o1 = (NoSuchObjectException) e; result.setO1IsSet(true); @@ -15363,25 +15461,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, drop_table_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.drop_table(args.dbname, args.name, args.deleteData,resultHandler); + public void start(I iface, drop_constraint_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.drop_constraint(args.dbname, args.tablename, args.constraintname,resultHandler); } } - public static class drop_table_with_environment_context extends org.apache.thrift.AsyncProcessFunction { - public drop_table_with_environment_context() { - super("drop_table_with_environment_context"); + public static class drop_table extends org.apache.thrift.AsyncProcessFunction { + public drop_table() { + super("drop_table"); } - public drop_table_with_environment_context_args getEmptyArgsInstance() { - return new drop_table_with_environment_context_args(); + public drop_table_args getEmptyArgsInstance() { + return new drop_table_args(); } public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback() { public void onComplete(Void o) { - drop_table_with_environment_context_result result = new drop_table_with_environment_context_result(); + drop_table_result result = new drop_table_result(); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -15393,7 +15491,7 @@ public void onComplete(Void o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - drop_table_with_environment_context_result result = new drop_table_with_environment_context_result(); + drop_table_result result = new drop_table_result(); if (e instanceof NoSuchObjectException) { result.o1 = (NoSuchObjectException) e; result.setO1IsSet(true); @@ -15424,259 +15522,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, drop_table_with_environment_context_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.drop_table_with_environment_context(args.dbname, args.name, args.deleteData, args.environment_context,resultHandler); - } - } - - public static class get_tables extends org.apache.thrift.AsyncProcessFunction> { - public get_tables() { - super("get_tables"); - } - - public get_tables_args getEmptyArgsInstance() { - return new get_tables_args(); - } - - public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback>() { - public void onComplete(List o) { - get_tables_result result = new get_tables_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - get_tables_result result = new get_tables_result(); - if (e instanceof MetaException) { - result.o1 = (MetaException) e; - result.setO1IsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, get_tables_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { - iface.get_tables(args.db_name, args.pattern,resultHandler); - } - } - - public static class get_table_meta extends org.apache.thrift.AsyncProcessFunction> { - public get_table_meta() { - super("get_table_meta"); - } - - public get_table_meta_args getEmptyArgsInstance() { - return new get_table_meta_args(); - } - - public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback>() { - public void onComplete(List o) { - get_table_meta_result result = new get_table_meta_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - get_table_meta_result result = new get_table_meta_result(); - if (e instanceof MetaException) { - result.o1 = (MetaException) e; - result.setO1IsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, get_table_meta_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { - iface.get_table_meta(args.db_patterns, args.tbl_patterns, args.tbl_types,resultHandler); - } - } - - public static class get_all_tables extends org.apache.thrift.AsyncProcessFunction> { - public get_all_tables() { - super("get_all_tables"); - } - - public get_all_tables_args getEmptyArgsInstance() { - return new get_all_tables_args(); - } - - public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback>() { - public void onComplete(List o) { - get_all_tables_result result = new get_all_tables_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - get_all_tables_result result = new get_all_tables_result(); - if (e instanceof MetaException) { - result.o1 = (MetaException) e; - result.setO1IsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, get_all_tables_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { - iface.get_all_tables(args.db_name,resultHandler); - } - } - - public static class get_table extends org.apache.thrift.AsyncProcessFunction { - public get_table() { - super("get_table"); - } - - public get_table_args getEmptyArgsInstance() { - return new get_table_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback
() { - public void onComplete(Table o) { - get_table_result result = new get_table_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - get_table_result result = new get_table_result(); - if (e instanceof MetaException) { - result.o1 = (MetaException) e; - result.setO1IsSet(true); - msg = result; - } - else if (e instanceof NoSuchObjectException) { - result.o2 = (NoSuchObjectException) e; - result.setO2IsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, get_table_args args, org.apache.thrift.async.AsyncMethodCallback
resultHandler) throws TException { - iface.get_table(args.dbname, args.tbl_name,resultHandler); + public void start(I iface, drop_table_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.drop_table(args.dbname, args.name, args.deleteData,resultHandler); } } - public static class get_table_objects_by_name extends org.apache.thrift.AsyncProcessFunction> { - public get_table_objects_by_name() { - super("get_table_objects_by_name"); + public static class drop_table_with_environment_context extends org.apache.thrift.AsyncProcessFunction { + public drop_table_with_environment_context() { + super("drop_table_with_environment_context"); } - public get_table_objects_by_name_args getEmptyArgsInstance() { - return new get_table_objects_by_name_args(); + public drop_table_with_environment_context_args getEmptyArgsInstance() { + return new drop_table_with_environment_context_args(); } - public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback>() { - public void onComplete(List
o) { - get_table_objects_by_name_result result = new get_table_objects_by_name_result(); - result.success = o; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + drop_table_with_environment_context_result result = new drop_table_with_environment_context_result(); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -15688,19 +15552,14 @@ public void onComplete(List
o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - get_table_objects_by_name_result result = new get_table_objects_by_name_result(); - if (e instanceof MetaException) { - result.o1 = (MetaException) e; + drop_table_with_environment_context_result result = new drop_table_with_environment_context_result(); + if (e instanceof NoSuchObjectException) { + result.o1 = (NoSuchObjectException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof InvalidOperationException) { - result.o2 = (InvalidOperationException) e; - result.setO2IsSet(true); - msg = result; - } - else if (e instanceof UnknownDBException) { - result.o3 = (UnknownDBException) e; + else if (e instanceof MetaException) { + result.o3 = (MetaException) e; result.setO3IsSet(true); msg = result; } @@ -15724,25 +15583,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, get_table_objects_by_name_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { - iface.get_table_objects_by_name(args.dbname, args.tbl_names,resultHandler); + public void start(I iface, drop_table_with_environment_context_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.drop_table_with_environment_context(args.dbname, args.name, args.deleteData, args.environment_context,resultHandler); } } - public static class get_table_names_by_filter extends org.apache.thrift.AsyncProcessFunction> { - public get_table_names_by_filter() { - super("get_table_names_by_filter"); + public static class get_tables extends org.apache.thrift.AsyncProcessFunction> { + public get_tables() { + super("get_tables"); } - public get_table_names_by_filter_args getEmptyArgsInstance() { - return new get_table_names_by_filter_args(); + public get_tables_args getEmptyArgsInstance() { + return new get_tables_args(); } public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback>() { public void onComplete(List o) { - get_table_names_by_filter_result result = new get_table_names_by_filter_result(); + get_tables_result result = new get_tables_result(); result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); @@ -15755,22 +15614,12 @@ public void onComplete(List o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - get_table_names_by_filter_result result = new get_table_names_by_filter_result(); + get_tables_result result = new get_tables_result(); if (e instanceof MetaException) { result.o1 = (MetaException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof InvalidOperationException) { - result.o2 = (InvalidOperationException) e; - result.setO2IsSet(true); - msg = result; - } - else if (e instanceof UnknownDBException) { - result.o3 = (UnknownDBException) e; - result.setO3IsSet(true); - msg = result; - } else { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; @@ -15791,25 +15640,26 @@ protected boolean isOneway() { return false; } - public void start(I iface, get_table_names_by_filter_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { - iface.get_table_names_by_filter(args.dbname, args.filter, args.max_tables,resultHandler); + public void start(I iface, get_tables_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { + iface.get_tables(args.db_name, args.pattern,resultHandler); } } - public static class alter_table extends org.apache.thrift.AsyncProcessFunction { - public alter_table() { - super("alter_table"); + public static class get_table_meta extends org.apache.thrift.AsyncProcessFunction> { + public get_table_meta() { + super("get_table_meta"); } - public alter_table_args getEmptyArgsInstance() { - return new alter_table_args(); + public get_table_meta_args getEmptyArgsInstance() { + return new get_table_meta_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Void o) { - alter_table_result result = new alter_table_result(); + return new AsyncMethodCallback>() { + public void onComplete(List o) { + get_table_meta_result result = new get_table_meta_result(); + result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -15821,17 +15671,12 @@ public void onComplete(Void o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - alter_table_result result = new alter_table_result(); - if (e instanceof InvalidOperationException) { - result.o1 = (InvalidOperationException) e; + get_table_meta_result result = new get_table_meta_result(); + if (e instanceof MetaException) { + result.o1 = (MetaException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof MetaException) { - result.o2 = (MetaException) e; - result.setO2IsSet(true); - msg = result; - } else { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; @@ -15852,25 +15697,26 @@ protected boolean isOneway() { return false; } - public void start(I iface, alter_table_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.alter_table(args.dbname, args.tbl_name, args.new_tbl,resultHandler); + public void start(I iface, get_table_meta_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { + iface.get_table_meta(args.db_patterns, args.tbl_patterns, args.tbl_types,resultHandler); } } - public static class alter_table_with_environment_context extends org.apache.thrift.AsyncProcessFunction { - public alter_table_with_environment_context() { - super("alter_table_with_environment_context"); + public static class get_all_tables extends org.apache.thrift.AsyncProcessFunction> { + public get_all_tables() { + super("get_all_tables"); } - public alter_table_with_environment_context_args getEmptyArgsInstance() { - return new alter_table_with_environment_context_args(); + public get_all_tables_args getEmptyArgsInstance() { + return new get_all_tables_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Void o) { - alter_table_with_environment_context_result result = new alter_table_with_environment_context_result(); + return new AsyncMethodCallback>() { + public void onComplete(List o) { + get_all_tables_result result = new get_all_tables_result(); + result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -15882,17 +15728,12 @@ public void onComplete(Void o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - alter_table_with_environment_context_result result = new alter_table_with_environment_context_result(); - if (e instanceof InvalidOperationException) { - result.o1 = (InvalidOperationException) e; + get_all_tables_result result = new get_all_tables_result(); + if (e instanceof MetaException) { + result.o1 = (MetaException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof MetaException) { - result.o2 = (MetaException) e; - result.setO2IsSet(true); - msg = result; - } else { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; @@ -15913,25 +15754,26 @@ protected boolean isOneway() { return false; } - public void start(I iface, alter_table_with_environment_context_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.alter_table_with_environment_context(args.dbname, args.tbl_name, args.new_tbl, args.environment_context,resultHandler); + public void start(I iface, get_all_tables_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { + iface.get_all_tables(args.db_name,resultHandler); } } - public static class alter_table_with_cascade extends org.apache.thrift.AsyncProcessFunction { - public alter_table_with_cascade() { - super("alter_table_with_cascade"); + public static class get_table extends org.apache.thrift.AsyncProcessFunction { + public get_table() { + super("get_table"); } - public alter_table_with_cascade_args getEmptyArgsInstance() { - return new alter_table_with_cascade_args(); + public get_table_args getEmptyArgsInstance() { + return new get_table_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback
getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Void o) { - alter_table_with_cascade_result result = new alter_table_with_cascade_result(); + return new AsyncMethodCallback
() { + public void onComplete(Table o) { + get_table_result result = new get_table_result(); + result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -15943,14 +15785,14 @@ public void onComplete(Void o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - alter_table_with_cascade_result result = new alter_table_with_cascade_result(); - if (e instanceof InvalidOperationException) { - result.o1 = (InvalidOperationException) e; + get_table_result result = new get_table_result(); + if (e instanceof MetaException) { + result.o1 = (MetaException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof MetaException) { - result.o2 = (MetaException) e; + else if (e instanceof NoSuchObjectException) { + result.o2 = (NoSuchObjectException) e; result.setO2IsSet(true); msg = result; } @@ -15974,25 +15816,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, alter_table_with_cascade_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.alter_table_with_cascade(args.dbname, args.tbl_name, args.new_tbl, args.cascade,resultHandler); + public void start(I iface, get_table_args args, org.apache.thrift.async.AsyncMethodCallback
resultHandler) throws TException { + iface.get_table(args.dbname, args.tbl_name,resultHandler); } } - public static class add_partition extends org.apache.thrift.AsyncProcessFunction { - public add_partition() { - super("add_partition"); + public static class get_table_objects_by_name extends org.apache.thrift.AsyncProcessFunction> { + public get_table_objects_by_name() { + super("get_table_objects_by_name"); } - public add_partition_args getEmptyArgsInstance() { - return new add_partition_args(); + public get_table_objects_by_name_args getEmptyArgsInstance() { + return new get_table_objects_by_name_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Partition o) { - add_partition_result result = new add_partition_result(); + return new AsyncMethodCallback>() { + public void onComplete(List
o) { + get_table_objects_by_name_result result = new get_table_objects_by_name_result(); result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); @@ -16005,19 +15847,19 @@ public void onComplete(Partition o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - add_partition_result result = new add_partition_result(); - if (e instanceof InvalidObjectException) { - result.o1 = (InvalidObjectException) e; + get_table_objects_by_name_result result = new get_table_objects_by_name_result(); + if (e instanceof MetaException) { + result.o1 = (MetaException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof AlreadyExistsException) { - result.o2 = (AlreadyExistsException) e; + else if (e instanceof InvalidOperationException) { + result.o2 = (InvalidOperationException) e; result.setO2IsSet(true); msg = result; } - else if (e instanceof MetaException) { - result.o3 = (MetaException) e; + else if (e instanceof UnknownDBException) { + result.o3 = (UnknownDBException) e; result.setO3IsSet(true); msg = result; } @@ -16041,25 +15883,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, add_partition_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.add_partition(args.new_part,resultHandler); + public void start(I iface, get_table_objects_by_name_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { + iface.get_table_objects_by_name(args.dbname, args.tbl_names,resultHandler); } } - public static class add_partition_with_environment_context extends org.apache.thrift.AsyncProcessFunction { - public add_partition_with_environment_context() { - super("add_partition_with_environment_context"); + public static class get_table_names_by_filter extends org.apache.thrift.AsyncProcessFunction> { + public get_table_names_by_filter() { + super("get_table_names_by_filter"); } - public add_partition_with_environment_context_args getEmptyArgsInstance() { - return new add_partition_with_environment_context_args(); + public get_table_names_by_filter_args getEmptyArgsInstance() { + return new get_table_names_by_filter_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Partition o) { - add_partition_with_environment_context_result result = new add_partition_with_environment_context_result(); + return new AsyncMethodCallback>() { + public void onComplete(List o) { + get_table_names_by_filter_result result = new get_table_names_by_filter_result(); result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); @@ -16072,19 +15914,19 @@ public void onComplete(Partition o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - add_partition_with_environment_context_result result = new add_partition_with_environment_context_result(); - if (e instanceof InvalidObjectException) { - result.o1 = (InvalidObjectException) e; + get_table_names_by_filter_result result = new get_table_names_by_filter_result(); + if (e instanceof MetaException) { + result.o1 = (MetaException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof AlreadyExistsException) { - result.o2 = (AlreadyExistsException) e; + else if (e instanceof InvalidOperationException) { + result.o2 = (InvalidOperationException) e; result.setO2IsSet(true); msg = result; } - else if (e instanceof MetaException) { - result.o3 = (MetaException) e; + else if (e instanceof UnknownDBException) { + result.o3 = (UnknownDBException) e; result.setO3IsSet(true); msg = result; } @@ -16108,27 +15950,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, add_partition_with_environment_context_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.add_partition_with_environment_context(args.new_part, args.environment_context,resultHandler); + public void start(I iface, get_table_names_by_filter_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { + iface.get_table_names_by_filter(args.dbname, args.filter, args.max_tables,resultHandler); } } - public static class add_partitions extends org.apache.thrift.AsyncProcessFunction { - public add_partitions() { - super("add_partitions"); + public static class alter_table extends org.apache.thrift.AsyncProcessFunction { + public alter_table() { + super("alter_table"); } - public add_partitions_args getEmptyArgsInstance() { - return new add_partitions_args(); + public alter_table_args getEmptyArgsInstance() { + return new alter_table_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Integer o) { - add_partitions_result result = new add_partitions_result(); - result.success = o; - result.setSuccessIsSet(true); + return new AsyncMethodCallback() { + public void onComplete(Void o) { + alter_table_result result = new alter_table_result(); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -16140,20 +15980,15 @@ public void onComplete(Integer o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - add_partitions_result result = new add_partitions_result(); - if (e instanceof InvalidObjectException) { - result.o1 = (InvalidObjectException) e; + alter_table_result result = new alter_table_result(); + if (e instanceof InvalidOperationException) { + result.o1 = (InvalidOperationException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof AlreadyExistsException) { - result.o2 = (AlreadyExistsException) e; - result.setO2IsSet(true); - msg = result; - } else if (e instanceof MetaException) { - result.o3 = (MetaException) e; - result.setO3IsSet(true); + result.o2 = (MetaException) e; + result.setO2IsSet(true); msg = result; } else @@ -16176,27 +16011,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, add_partitions_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.add_partitions(args.new_parts,resultHandler); + public void start(I iface, alter_table_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.alter_table(args.dbname, args.tbl_name, args.new_tbl,resultHandler); } } - public static class add_partitions_pspec extends org.apache.thrift.AsyncProcessFunction { - public add_partitions_pspec() { - super("add_partitions_pspec"); + public static class alter_table_with_environment_context extends org.apache.thrift.AsyncProcessFunction { + public alter_table_with_environment_context() { + super("alter_table_with_environment_context"); } - public add_partitions_pspec_args getEmptyArgsInstance() { - return new add_partitions_pspec_args(); + public alter_table_with_environment_context_args getEmptyArgsInstance() { + return new alter_table_with_environment_context_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Integer o) { - add_partitions_pspec_result result = new add_partitions_pspec_result(); - result.success = o; - result.setSuccessIsSet(true); + return new AsyncMethodCallback() { + public void onComplete(Void o) { + alter_table_with_environment_context_result result = new alter_table_with_environment_context_result(); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -16208,20 +16041,15 @@ public void onComplete(Integer o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - add_partitions_pspec_result result = new add_partitions_pspec_result(); - if (e instanceof InvalidObjectException) { - result.o1 = (InvalidObjectException) e; + alter_table_with_environment_context_result result = new alter_table_with_environment_context_result(); + if (e instanceof InvalidOperationException) { + result.o1 = (InvalidOperationException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof AlreadyExistsException) { - result.o2 = (AlreadyExistsException) e; - result.setO2IsSet(true); - msg = result; - } else if (e instanceof MetaException) { - result.o3 = (MetaException) e; - result.setO3IsSet(true); + result.o2 = (MetaException) e; + result.setO2IsSet(true); msg = result; } else @@ -16244,26 +16072,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, add_partitions_pspec_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.add_partitions_pspec(args.new_parts,resultHandler); + public void start(I iface, alter_table_with_environment_context_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.alter_table_with_environment_context(args.dbname, args.tbl_name, args.new_tbl, args.environment_context,resultHandler); } } - public static class append_partition extends org.apache.thrift.AsyncProcessFunction { - public append_partition() { - super("append_partition"); + public static class alter_table_with_cascade extends org.apache.thrift.AsyncProcessFunction { + public alter_table_with_cascade() { + super("alter_table_with_cascade"); } - public append_partition_args getEmptyArgsInstance() { - return new append_partition_args(); + public alter_table_with_cascade_args getEmptyArgsInstance() { + return new alter_table_with_cascade_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Partition o) { - append_partition_result result = new append_partition_result(); - result.success = o; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + alter_table_with_cascade_result result = new alter_table_with_cascade_result(); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -16275,20 +16102,15 @@ public void onComplete(Partition o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - append_partition_result result = new append_partition_result(); - if (e instanceof InvalidObjectException) { - result.o1 = (InvalidObjectException) e; + alter_table_with_cascade_result result = new alter_table_with_cascade_result(); + if (e instanceof InvalidOperationException) { + result.o1 = (InvalidOperationException) e; result.setO1IsSet(true); msg = result; } - else if (e instanceof AlreadyExistsException) { - result.o2 = (AlreadyExistsException) e; - result.setO2IsSet(true); - msg = result; - } else if (e instanceof MetaException) { - result.o3 = (MetaException) e; - result.setO3IsSet(true); + result.o2 = (MetaException) e; + result.setO2IsSet(true); msg = result; } else @@ -16311,25 +16133,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, append_partition_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.append_partition(args.db_name, args.tbl_name, args.part_vals,resultHandler); + public void start(I iface, alter_table_with_cascade_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.alter_table_with_cascade(args.dbname, args.tbl_name, args.new_tbl, args.cascade,resultHandler); } } - public static class add_partitions_req extends org.apache.thrift.AsyncProcessFunction { - public add_partitions_req() { - super("add_partitions_req"); + public static class add_partition extends org.apache.thrift.AsyncProcessFunction { + public add_partition() { + super("add_partition"); } - public add_partitions_req_args getEmptyArgsInstance() { - return new add_partitions_req_args(); + public add_partition_args getEmptyArgsInstance() { + return new add_partition_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(AddPartitionsResult o) { - add_partitions_req_result result = new add_partitions_req_result(); + return new AsyncMethodCallback() { + public void onComplete(Partition o) { + add_partition_result result = new add_partition_result(); result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); @@ -16342,7 +16164,7 @@ public void onComplete(AddPartitionsResult o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - add_partitions_req_result result = new add_partitions_req_result(); + add_partition_result result = new add_partition_result(); if (e instanceof InvalidObjectException) { result.o1 = (InvalidObjectException) e; result.setO1IsSet(true); @@ -16378,25 +16200,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, add_partitions_req_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.add_partitions_req(args.request,resultHandler); + public void start(I iface, add_partition_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.add_partition(args.new_part,resultHandler); } } - public static class append_partition_with_environment_context extends org.apache.thrift.AsyncProcessFunction { - public append_partition_with_environment_context() { - super("append_partition_with_environment_context"); + public static class add_partition_with_environment_context extends org.apache.thrift.AsyncProcessFunction { + public add_partition_with_environment_context() { + super("add_partition_with_environment_context"); } - public append_partition_with_environment_context_args getEmptyArgsInstance() { - return new append_partition_with_environment_context_args(); + public add_partition_with_environment_context_args getEmptyArgsInstance() { + return new add_partition_with_environment_context_args(); } public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback() { public void onComplete(Partition o) { - append_partition_with_environment_context_result result = new append_partition_with_environment_context_result(); + add_partition_with_environment_context_result result = new add_partition_with_environment_context_result(); result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); @@ -16409,7 +16231,7 @@ public void onComplete(Partition o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - append_partition_with_environment_context_result result = new append_partition_with_environment_context_result(); + add_partition_with_environment_context_result result = new add_partition_with_environment_context_result(); if (e instanceof InvalidObjectException) { result.o1 = (InvalidObjectException) e; result.setO1IsSet(true); @@ -16445,26 +16267,27 @@ protected boolean isOneway() { return false; } - public void start(I iface, append_partition_with_environment_context_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.append_partition_with_environment_context(args.db_name, args.tbl_name, args.part_vals, args.environment_context,resultHandler); + public void start(I iface, add_partition_with_environment_context_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.add_partition_with_environment_context(args.new_part, args.environment_context,resultHandler); } } - public static class append_partition_by_name extends org.apache.thrift.AsyncProcessFunction { - public append_partition_by_name() { - super("append_partition_by_name"); + public static class add_partitions extends org.apache.thrift.AsyncProcessFunction { + public add_partitions() { + super("add_partitions"); } - public append_partition_by_name_args getEmptyArgsInstance() { - return new append_partition_by_name_args(); + public add_partitions_args getEmptyArgsInstance() { + return new add_partitions_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Partition o) { - append_partition_by_name_result result = new append_partition_by_name_result(); + return new AsyncMethodCallback() { + public void onComplete(Integer o) { + add_partitions_result result = new add_partitions_result(); result.success = o; + result.setSuccessIsSet(true); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -16476,7 +16299,7 @@ public void onComplete(Partition o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - append_partition_by_name_result result = new append_partition_by_name_result(); + add_partitions_result result = new add_partitions_result(); if (e instanceof InvalidObjectException) { result.o1 = (InvalidObjectException) e; result.setO1IsSet(true); @@ -16512,26 +16335,27 @@ protected boolean isOneway() { return false; } - public void start(I iface, append_partition_by_name_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.append_partition_by_name(args.db_name, args.tbl_name, args.part_name,resultHandler); + public void start(I iface, add_partitions_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.add_partitions(args.new_parts,resultHandler); } } - public static class append_partition_by_name_with_environment_context extends org.apache.thrift.AsyncProcessFunction { - public append_partition_by_name_with_environment_context() { - super("append_partition_by_name_with_environment_context"); + public static class add_partitions_pspec extends org.apache.thrift.AsyncProcessFunction { + public add_partitions_pspec() { + super("add_partitions_pspec"); } - public append_partition_by_name_with_environment_context_args getEmptyArgsInstance() { - return new append_partition_by_name_with_environment_context_args(); + public add_partitions_pspec_args getEmptyArgsInstance() { + return new add_partitions_pspec_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Partition o) { - append_partition_by_name_with_environment_context_result result = new append_partition_by_name_with_environment_context_result(); + return new AsyncMethodCallback() { + public void onComplete(Integer o) { + add_partitions_pspec_result result = new add_partitions_pspec_result(); result.success = o; + result.setSuccessIsSet(true); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -16543,7 +16367,342 @@ public void onComplete(Partition o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - append_partition_by_name_with_environment_context_result result = new append_partition_by_name_with_environment_context_result(); + add_partitions_pspec_result result = new add_partitions_pspec_result(); + if (e instanceof InvalidObjectException) { + result.o1 = (InvalidObjectException) e; + result.setO1IsSet(true); + msg = result; + } + else if (e instanceof AlreadyExistsException) { + result.o2 = (AlreadyExistsException) e; + result.setO2IsSet(true); + msg = result; + } + else if (e instanceof MetaException) { + result.o3 = (MetaException) e; + result.setO3IsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, add_partitions_pspec_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.add_partitions_pspec(args.new_parts,resultHandler); + } + } + + public static class append_partition extends org.apache.thrift.AsyncProcessFunction { + public append_partition() { + super("append_partition"); + } + + public append_partition_args getEmptyArgsInstance() { + return new append_partition_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Partition o) { + append_partition_result result = new append_partition_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + append_partition_result result = new append_partition_result(); + if (e instanceof InvalidObjectException) { + result.o1 = (InvalidObjectException) e; + result.setO1IsSet(true); + msg = result; + } + else if (e instanceof AlreadyExistsException) { + result.o2 = (AlreadyExistsException) e; + result.setO2IsSet(true); + msg = result; + } + else if (e instanceof MetaException) { + result.o3 = (MetaException) e; + result.setO3IsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, append_partition_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.append_partition(args.db_name, args.tbl_name, args.part_vals,resultHandler); + } + } + + public static class add_partitions_req extends org.apache.thrift.AsyncProcessFunction { + public add_partitions_req() { + super("add_partitions_req"); + } + + public add_partitions_req_args getEmptyArgsInstance() { + return new add_partitions_req_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(AddPartitionsResult o) { + add_partitions_req_result result = new add_partitions_req_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + add_partitions_req_result result = new add_partitions_req_result(); + if (e instanceof InvalidObjectException) { + result.o1 = (InvalidObjectException) e; + result.setO1IsSet(true); + msg = result; + } + else if (e instanceof AlreadyExistsException) { + result.o2 = (AlreadyExistsException) e; + result.setO2IsSet(true); + msg = result; + } + else if (e instanceof MetaException) { + result.o3 = (MetaException) e; + result.setO3IsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, add_partitions_req_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.add_partitions_req(args.request,resultHandler); + } + } + + public static class append_partition_with_environment_context extends org.apache.thrift.AsyncProcessFunction { + public append_partition_with_environment_context() { + super("append_partition_with_environment_context"); + } + + public append_partition_with_environment_context_args getEmptyArgsInstance() { + return new append_partition_with_environment_context_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Partition o) { + append_partition_with_environment_context_result result = new append_partition_with_environment_context_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + append_partition_with_environment_context_result result = new append_partition_with_environment_context_result(); + if (e instanceof InvalidObjectException) { + result.o1 = (InvalidObjectException) e; + result.setO1IsSet(true); + msg = result; + } + else if (e instanceof AlreadyExistsException) { + result.o2 = (AlreadyExistsException) e; + result.setO2IsSet(true); + msg = result; + } + else if (e instanceof MetaException) { + result.o3 = (MetaException) e; + result.setO3IsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, append_partition_with_environment_context_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.append_partition_with_environment_context(args.db_name, args.tbl_name, args.part_vals, args.environment_context,resultHandler); + } + } + + public static class append_partition_by_name extends org.apache.thrift.AsyncProcessFunction { + public append_partition_by_name() { + super("append_partition_by_name"); + } + + public append_partition_by_name_args getEmptyArgsInstance() { + return new append_partition_by_name_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Partition o) { + append_partition_by_name_result result = new append_partition_by_name_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + append_partition_by_name_result result = new append_partition_by_name_result(); + if (e instanceof InvalidObjectException) { + result.o1 = (InvalidObjectException) e; + result.setO1IsSet(true); + msg = result; + } + else if (e instanceof AlreadyExistsException) { + result.o2 = (AlreadyExistsException) e; + result.setO2IsSet(true); + msg = result; + } + else if (e instanceof MetaException) { + result.o3 = (MetaException) e; + result.setO3IsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, append_partition_by_name_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.append_partition_by_name(args.db_name, args.tbl_name, args.part_name,resultHandler); + } + } + + public static class append_partition_by_name_with_environment_context extends org.apache.thrift.AsyncProcessFunction { + public append_partition_by_name_with_environment_context() { + super("append_partition_by_name_with_environment_context"); + } + + public append_partition_by_name_with_environment_context_args getEmptyArgsInstance() { + return new append_partition_by_name_with_environment_context_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Partition o) { + append_partition_by_name_with_environment_context_result result = new append_partition_by_name_with_environment_context_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + append_partition_by_name_with_environment_context_result result = new append_partition_by_name_with_environment_context_result(); if (e instanceof InvalidObjectException) { result.o1 = (InvalidObjectException) e; result.setO1IsSet(true); @@ -42513,6 +42672,1038 @@ public void read(org.apache.thrift.protocol.TProtocol prot, create_table_with_co } + public static class drop_constraint_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("drop_constraint_args"); + + private static final org.apache.thrift.protocol.TField DBNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbname", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField TABLENAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tablename", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField CONSTRAINTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("constraintname", org.apache.thrift.protocol.TType.STRING, (short)3); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new drop_constraint_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new drop_constraint_argsTupleSchemeFactory()); + } + + private String dbname; // required + private String tablename; // required + private String constraintname; // 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 { + DBNAME((short)1, "dbname"), + TABLENAME((short)2, "tablename"), + CONSTRAINTNAME((short)3, "constraintname"); + + 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: // DBNAME + return DBNAME; + case 2: // TABLENAME + return TABLENAME; + case 3: // CONSTRAINTNAME + return CONSTRAINTNAME; + 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.DBNAME, new org.apache.thrift.meta_data.FieldMetaData("dbname", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.TABLENAME, new org.apache.thrift.meta_data.FieldMetaData("tablename", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CONSTRAINTNAME, new org.apache.thrift.meta_data.FieldMetaData("constraintname", 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(drop_constraint_args.class, metaDataMap); + } + + public drop_constraint_args() { + } + + public drop_constraint_args( + String dbname, + String tablename, + String constraintname) + { + this(); + this.dbname = dbname; + this.tablename = tablename; + this.constraintname = constraintname; + } + + /** + * Performs a deep copy on other. + */ + public drop_constraint_args(drop_constraint_args other) { + if (other.isSetDbname()) { + this.dbname = other.dbname; + } + if (other.isSetTablename()) { + this.tablename = other.tablename; + } + if (other.isSetConstraintname()) { + this.constraintname = other.constraintname; + } + } + + public drop_constraint_args deepCopy() { + return new drop_constraint_args(this); + } + + @Override + public void clear() { + this.dbname = null; + this.tablename = null; + this.constraintname = null; + } + + public String getDbname() { + return this.dbname; + } + + public void setDbname(String dbname) { + this.dbname = dbname; + } + + public void unsetDbname() { + this.dbname = null; + } + + /** Returns true if field dbname is set (has been assigned a value) and false otherwise */ + public boolean isSetDbname() { + return this.dbname != null; + } + + public void setDbnameIsSet(boolean value) { + if (!value) { + this.dbname = null; + } + } + + public String getTablename() { + return this.tablename; + } + + public void setTablename(String tablename) { + this.tablename = tablename; + } + + public void unsetTablename() { + this.tablename = null; + } + + /** Returns true if field tablename is set (has been assigned a value) and false otherwise */ + public boolean isSetTablename() { + return this.tablename != null; + } + + public void setTablenameIsSet(boolean value) { + if (!value) { + this.tablename = null; + } + } + + public String getConstraintname() { + return this.constraintname; + } + + public void setConstraintname(String constraintname) { + this.constraintname = constraintname; + } + + public void unsetConstraintname() { + this.constraintname = null; + } + + /** Returns true if field constraintname is set (has been assigned a value) and false otherwise */ + public boolean isSetConstraintname() { + return this.constraintname != null; + } + + public void setConstraintnameIsSet(boolean value) { + if (!value) { + this.constraintname = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DBNAME: + if (value == null) { + unsetDbname(); + } else { + setDbname((String)value); + } + break; + + case TABLENAME: + if (value == null) { + unsetTablename(); + } else { + setTablename((String)value); + } + break; + + case CONSTRAINTNAME: + if (value == null) { + unsetConstraintname(); + } else { + setConstraintname((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DBNAME: + return getDbname(); + + case TABLENAME: + return getTablename(); + + case CONSTRAINTNAME: + return getConstraintname(); + + } + 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 DBNAME: + return isSetDbname(); + case TABLENAME: + return isSetTablename(); + case CONSTRAINTNAME: + return isSetConstraintname(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof drop_constraint_args) + return this.equals((drop_constraint_args)that); + return false; + } + + public boolean equals(drop_constraint_args that) { + if (that == null) + return false; + + boolean this_present_dbname = true && this.isSetDbname(); + boolean that_present_dbname = true && that.isSetDbname(); + if (this_present_dbname || that_present_dbname) { + if (!(this_present_dbname && that_present_dbname)) + return false; + if (!this.dbname.equals(that.dbname)) + return false; + } + + boolean this_present_tablename = true && this.isSetTablename(); + boolean that_present_tablename = true && that.isSetTablename(); + if (this_present_tablename || that_present_tablename) { + if (!(this_present_tablename && that_present_tablename)) + return false; + if (!this.tablename.equals(that.tablename)) + return false; + } + + boolean this_present_constraintname = true && this.isSetConstraintname(); + boolean that_present_constraintname = true && that.isSetConstraintname(); + if (this_present_constraintname || that_present_constraintname) { + if (!(this_present_constraintname && that_present_constraintname)) + return false; + if (!this.constraintname.equals(that.constraintname)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_dbname = true && (isSetDbname()); + list.add(present_dbname); + if (present_dbname) + list.add(dbname); + + boolean present_tablename = true && (isSetTablename()); + list.add(present_tablename); + if (present_tablename) + list.add(tablename); + + boolean present_constraintname = true && (isSetConstraintname()); + list.add(present_constraintname); + if (present_constraintname) + list.add(constraintname); + + return list.hashCode(); + } + + @Override + public int compareTo(drop_constraint_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDbname()).compareTo(other.isSetDbname()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDbname()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbname, other.dbname); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetTablename()).compareTo(other.isSetTablename()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTablename()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tablename, other.tablename); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetConstraintname()).compareTo(other.isSetConstraintname()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetConstraintname()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.constraintname, other.constraintname); + 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("drop_constraint_args("); + boolean first = true; + + sb.append("dbname:"); + if (this.dbname == null) { + sb.append("null"); + } else { + sb.append(this.dbname); + } + first = false; + if (!first) sb.append(", "); + sb.append("tablename:"); + if (this.tablename == null) { + sb.append("null"); + } else { + sb.append(this.tablename); + } + first = false; + if (!first) sb.append(", "); + sb.append("constraintname:"); + if (this.constraintname == null) { + sb.append("null"); + } else { + sb.append(this.constraintname); + } + 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 drop_constraint_argsStandardSchemeFactory implements SchemeFactory { + public drop_constraint_argsStandardScheme getScheme() { + return new drop_constraint_argsStandardScheme(); + } + } + + private static class drop_constraint_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, drop_constraint_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: // DBNAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.dbname = iprot.readString(); + struct.setDbnameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // TABLENAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.tablename = iprot.readString(); + struct.setTablenameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // CONSTRAINTNAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.constraintname = iprot.readString(); + struct.setConstraintnameIsSet(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, drop_constraint_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.dbname != null) { + oprot.writeFieldBegin(DBNAME_FIELD_DESC); + oprot.writeString(struct.dbname); + oprot.writeFieldEnd(); + } + if (struct.tablename != null) { + oprot.writeFieldBegin(TABLENAME_FIELD_DESC); + oprot.writeString(struct.tablename); + oprot.writeFieldEnd(); + } + if (struct.constraintname != null) { + oprot.writeFieldBegin(CONSTRAINTNAME_FIELD_DESC); + oprot.writeString(struct.constraintname); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class drop_constraint_argsTupleSchemeFactory implements SchemeFactory { + public drop_constraint_argsTupleScheme getScheme() { + return new drop_constraint_argsTupleScheme(); + } + } + + private static class drop_constraint_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, drop_constraint_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDbname()) { + optionals.set(0); + } + if (struct.isSetTablename()) { + optionals.set(1); + } + if (struct.isSetConstraintname()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetDbname()) { + oprot.writeString(struct.dbname); + } + if (struct.isSetTablename()) { + oprot.writeString(struct.tablename); + } + if (struct.isSetConstraintname()) { + oprot.writeString(struct.constraintname); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, drop_constraint_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.dbname = iprot.readString(); + struct.setDbnameIsSet(true); + } + if (incoming.get(1)) { + struct.tablename = iprot.readString(); + struct.setTablenameIsSet(true); + } + if (incoming.get(2)) { + struct.constraintname = iprot.readString(); + struct.setConstraintnameIsSet(true); + } + } + } + + } + + public static class drop_constraint_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("drop_constraint_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 org.apache.thrift.protocol.TField O3_FIELD_DESC = new org.apache.thrift.protocol.TField("o3", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new drop_constraint_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new drop_constraint_resultTupleSchemeFactory()); + } + + private NoSuchObjectException o1; // required + private MetaException o3; // 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"), + O3((short)2, "o3"); + + 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; + case 2: // O3 + return O3; + 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))); + tmpMap.put(_Fields.O3, new org.apache.thrift.meta_data.FieldMetaData("o3", 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(drop_constraint_result.class, metaDataMap); + } + + public drop_constraint_result() { + } + + public drop_constraint_result( + NoSuchObjectException o1, + MetaException o3) + { + this(); + this.o1 = o1; + this.o3 = o3; + } + + /** + * Performs a deep copy on other. + */ + public drop_constraint_result(drop_constraint_result other) { + if (other.isSetO1()) { + this.o1 = new NoSuchObjectException(other.o1); + } + if (other.isSetO3()) { + this.o3 = new MetaException(other.o3); + } + } + + public drop_constraint_result deepCopy() { + return new drop_constraint_result(this); + } + + @Override + public void clear() { + this.o1 = null; + this.o3 = null; + } + + public NoSuchObjectException getO1() { + return this.o1; + } + + public void setO1(NoSuchObjectException 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 MetaException getO3() { + return this.o3; + } + + public void setO3(MetaException o3) { + this.o3 = o3; + } + + public void unsetO3() { + this.o3 = null; + } + + /** Returns true if field o3 is set (has been assigned a value) and false otherwise */ + public boolean isSetO3() { + return this.o3 != null; + } + + public void setO3IsSet(boolean value) { + if (!value) { + this.o3 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((NoSuchObjectException)value); + } + break; + + case O3: + if (value == null) { + unsetO3(); + } else { + setO3((MetaException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case O1: + return getO1(); + + case O3: + return getO3(); + + } + 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(); + case O3: + return isSetO3(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof drop_constraint_result) + return this.equals((drop_constraint_result)that); + return false; + } + + public boolean equals(drop_constraint_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; + } + + boolean this_present_o3 = true && this.isSetO3(); + boolean that_present_o3 = true && that.isSetO3(); + if (this_present_o3 || that_present_o3) { + if (!(this_present_o3 && that_present_o3)) + return false; + if (!this.o3.equals(that.o3)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_o1 = true && (isSetO1()); + list.add(present_o1); + if (present_o1) + list.add(o1); + + boolean present_o3 = true && (isSetO3()); + list.add(present_o3); + if (present_o3) + list.add(o3); + + return list.hashCode(); + } + + @Override + public int compareTo(drop_constraint_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetO1()).compareTo(other.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o1, other.o1); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetO3()).compareTo(other.isSetO3()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO3()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o3, other.o3); + 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("drop_constraint_result("); + boolean first = true; + + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + if (!first) sb.append(", "); + sb.append("o3:"); + if (this.o3 == null) { + sb.append("null"); + } else { + sb.append(this.o3); + } + 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 drop_constraint_resultStandardSchemeFactory implements SchemeFactory { + public drop_constraint_resultStandardScheme getScheme() { + return new drop_constraint_resultStandardScheme(); + } + } + + private static class drop_constraint_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, drop_constraint_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 NoSuchObjectException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // O3 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.o3 = new MetaException(); + struct.o3.read(iprot); + struct.setO3IsSet(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, drop_constraint_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(); + } + if (struct.o3 != null) { + oprot.writeFieldBegin(O3_FIELD_DESC); + struct.o3.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class drop_constraint_resultTupleSchemeFactory implements SchemeFactory { + public drop_constraint_resultTupleScheme getScheme() { + return new drop_constraint_resultTupleScheme(); + } + } + + private static class drop_constraint_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, drop_constraint_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetO1()) { + optionals.set(0); + } + if (struct.isSetO3()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetO1()) { + struct.o1.write(oprot); + } + if (struct.isSetO3()) { + struct.o3.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, drop_constraint_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.o1 = new NoSuchObjectException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } + if (incoming.get(1)) { + struct.o3 = new MetaException(); + struct.o3.read(iprot); + struct.setO3IsSet(true); + } + } + } + + } + public static class drop_table_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("drop_table_args"); diff --git a/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php b/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php index 4f0c8fd..875ab9a 100644 --- a/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php +++ b/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php @@ -168,6 +168,14 @@ interface ThriftHiveMetastoreIf extends \FacebookServiceIf { public function create_table_with_constraints(\metastore\Table $tbl, array $primaryKeys, array $foreignKeys); /** * @param string $dbname + * @param string $tablename + * @param string $constraintname + * @throws \metastore\NoSuchObjectException + * @throws \metastore\MetaException + */ + public function drop_constraint($dbname, $tablename, $constraintname); + /** + * @param string $dbname * @param string $name * @param bool $deleteData * @throws \metastore\NoSuchObjectException @@ -2250,6 +2258,62 @@ class ThriftHiveMetastoreClient extends \FacebookServiceClient implements \metas return; } + public function drop_constraint($dbname, $tablename, $constraintname) + { + $this->send_drop_constraint($dbname, $tablename, $constraintname); + $this->recv_drop_constraint(); + } + + public function send_drop_constraint($dbname, $tablename, $constraintname) + { + $args = new \metastore\ThriftHiveMetastore_drop_constraint_args(); + $args->dbname = $dbname; + $args->tablename = $tablename; + $args->constraintname = $constraintname; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'drop_constraint', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('drop_constraint', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_drop_constraint() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\metastore\ThriftHiveMetastore_drop_constraint_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_drop_constraint_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->o1 !== null) { + throw $result->o1; + } + if ($result->o3 !== null) { + throw $result->o3; + } + return; + } + public function drop_table($dbname, $name, $deleteData) { $this->send_drop_table($dbname, $name, $deleteData); @@ -13889,6 +13953,229 @@ class ThriftHiveMetastore_create_table_with_constraints_result { } +class ThriftHiveMetastore_drop_constraint_args { + static $_TSPEC; + + /** + * @var string + */ + public $dbname = null; + /** + * @var string + */ + public $tablename = null; + /** + * @var string + */ + public $constraintname = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'dbname', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'tablename', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'constraintname', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['dbname'])) { + $this->dbname = $vals['dbname']; + } + if (isset($vals['tablename'])) { + $this->tablename = $vals['tablename']; + } + if (isset($vals['constraintname'])) { + $this->constraintname = $vals['constraintname']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_drop_constraint_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->dbname); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->tablename); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->constraintname); + } 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_drop_constraint_args'); + if ($this->dbname !== null) { + $xfer += $output->writeFieldBegin('dbname', TType::STRING, 1); + $xfer += $output->writeString($this->dbname); + $xfer += $output->writeFieldEnd(); + } + if ($this->tablename !== null) { + $xfer += $output->writeFieldBegin('tablename', TType::STRING, 2); + $xfer += $output->writeString($this->tablename); + $xfer += $output->writeFieldEnd(); + } + if ($this->constraintname !== null) { + $xfer += $output->writeFieldBegin('constraintname', TType::STRING, 3); + $xfer += $output->writeString($this->constraintname); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftHiveMetastore_drop_constraint_result { + static $_TSPEC; + + /** + * @var \metastore\NoSuchObjectException + */ + public $o1 = null; + /** + * @var \metastore\MetaException + */ + public $o3 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => '\metastore\NoSuchObjectException', + ), + 2 => array( + 'var' => 'o3', + 'type' => TType::STRUCT, + 'class' => '\metastore\MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + if (isset($vals['o3'])) { + $this->o3 = $vals['o3']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_drop_constraint_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\NoSuchObjectException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRUCT) { + $this->o3 = new \metastore\MetaException(); + $xfer += $this->o3->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_drop_constraint_result'); + if ($this->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->o3 !== null) { + $xfer += $output->writeFieldBegin('o3', TType::STRUCT, 2); + $xfer += $this->o3->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class ThriftHiveMetastore_drop_table_args { static $_TSPEC; diff --git a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote index 3ec46f1..b440d73 100755 --- a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote +++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote @@ -43,6 +43,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' void create_table(Table tbl)') print(' void create_table_with_environment_context(Table tbl, EnvironmentContext environment_context)') print(' void create_table_with_constraints(Table tbl, primaryKeys, foreignKeys)') + print(' void drop_constraint(string dbname, string tablename, string constraintname)') print(' void drop_table(string dbname, string name, bool deleteData)') print(' void drop_table_with_environment_context(string dbname, string name, bool deleteData, EnvironmentContext environment_context)') print(' get_tables(string db_name, string pattern)') @@ -353,6 +354,12 @@ elif cmd == 'create_table_with_constraints': sys.exit(1) pp.pprint(client.create_table_with_constraints(eval(args[0]),eval(args[1]),eval(args[2]),)) +elif cmd == 'drop_constraint': + if len(args) != 3: + print('drop_constraint requires 3 args') + sys.exit(1) + pp.pprint(client.drop_constraint(args[0],args[1],args[2],)) + elif cmd == 'drop_table': if len(args) != 3: print('drop_table requires 3 args') diff --git a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py index 119a5f1..9fb54bb 100644 --- a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py +++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py @@ -165,6 +165,15 @@ def create_table_with_constraints(self, tbl, primaryKeys, foreignKeys): """ pass + def drop_constraint(self, dbname, tablename, constraintname): + """ + Parameters: + - dbname + - tablename + - constraintname + """ + pass + def drop_table(self, dbname, name, deleteData): """ Parameters: @@ -1875,6 +1884,43 @@ def recv_create_table_with_constraints(self): raise result.o4 return + def drop_constraint(self, dbname, tablename, constraintname): + """ + Parameters: + - dbname + - tablename + - constraintname + """ + self.send_drop_constraint(dbname, tablename, constraintname) + self.recv_drop_constraint() + + def send_drop_constraint(self, dbname, tablename, constraintname): + self._oprot.writeMessageBegin('drop_constraint', TMessageType.CALL, self._seqid) + args = drop_constraint_args() + args.dbname = dbname + args.tablename = tablename + args.constraintname = constraintname + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_drop_constraint(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = drop_constraint_result() + result.read(iprot) + iprot.readMessageEnd() + if result.o1 is not None: + raise result.o1 + if result.o3 is not None: + raise result.o3 + return + def drop_table(self, dbname, name, deleteData): """ Parameters: @@ -6499,6 +6545,7 @@ def __init__(self, handler): self._processMap["create_table"] = Processor.process_create_table self._processMap["create_table_with_environment_context"] = Processor.process_create_table_with_environment_context self._processMap["create_table_with_constraints"] = Processor.process_create_table_with_constraints + self._processMap["drop_constraint"] = Processor.process_drop_constraint self._processMap["drop_table"] = Processor.process_drop_table self._processMap["drop_table_with_environment_context"] = Processor.process_drop_table_with_environment_context self._processMap["get_tables"] = Processor.process_get_tables @@ -7141,6 +7188,31 @@ def process_create_table_with_constraints(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_drop_constraint(self, seqid, iprot, oprot): + args = drop_constraint_args() + args.read(iprot) + iprot.readMessageEnd() + result = drop_constraint_result() + try: + self._handler.drop_constraint(args.dbname, args.tablename, args.constraintname) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except NoSuchObjectException as o1: + msg_type = TMessageType.REPLY + result.o1 = o1 + except MetaException as o3: + msg_type = TMessageType.REPLY + result.o3 = o3 + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("drop_constraint", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_drop_table(self, seqid, iprot, oprot): args = drop_table_args() args.read(iprot) @@ -13467,6 +13539,177 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +class drop_constraint_args: + """ + Attributes: + - dbname + - tablename + - constraintname + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'dbname', None, None, ), # 1 + (2, TType.STRING, 'tablename', None, None, ), # 2 + (3, TType.STRING, 'constraintname', None, None, ), # 3 + ) + + def __init__(self, dbname=None, tablename=None, constraintname=None,): + self.dbname = dbname + self.tablename = tablename + self.constraintname = constraintname + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.dbname = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.tablename = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.constraintname = iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('drop_constraint_args') + if self.dbname is not None: + oprot.writeFieldBegin('dbname', TType.STRING, 1) + oprot.writeString(self.dbname) + oprot.writeFieldEnd() + if self.tablename is not None: + oprot.writeFieldBegin('tablename', TType.STRING, 2) + oprot.writeString(self.tablename) + oprot.writeFieldEnd() + if self.constraintname is not None: + oprot.writeFieldBegin('constraintname', TType.STRING, 3) + oprot.writeString(self.constraintname) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.dbname) + value = (value * 31) ^ hash(self.tablename) + value = (value * 31) ^ hash(self.constraintname) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class drop_constraint_result: + """ + Attributes: + - o1 + - o3 + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'o1', (NoSuchObjectException, NoSuchObjectException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'o3', (MetaException, MetaException.thrift_spec), None, ), # 2 + ) + + def __init__(self, o1=None, o3=None,): + self.o1 = o1 + self.o3 = o3 + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.o1 = NoSuchObjectException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.o3 = MetaException() + self.o3.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('drop_constraint_result') + if self.o1 is not None: + oprot.writeFieldBegin('o1', TType.STRUCT, 1) + self.o1.write(oprot) + oprot.writeFieldEnd() + if self.o3 is not None: + oprot.writeFieldBegin('o3', TType.STRUCT, 2) + self.o3.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.o1) + value = (value * 31) ^ hash(self.o3) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class drop_table_args: """ Attributes: diff --git a/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb b/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb index 99a764e..0ae44da 100644 --- a/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb +++ b/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb @@ -336,6 +336,22 @@ module ThriftHiveMetastore return end + def drop_constraint(dbname, tablename, constraintname) + send_drop_constraint(dbname, tablename, constraintname) + recv_drop_constraint() + end + + def send_drop_constraint(dbname, tablename, constraintname) + send_message('drop_constraint', Drop_constraint_args, :dbname => dbname, :tablename => tablename, :constraintname => constraintname) + end + + def recv_drop_constraint() + result = receive_message(Drop_constraint_result) + raise result.o1 unless result.o1.nil? + raise result.o3 unless result.o3.nil? + return + end + def drop_table(dbname, name, deleteData) send_drop_table(dbname, name, deleteData) recv_drop_table() @@ -2704,6 +2720,19 @@ module ThriftHiveMetastore write_result(result, oprot, 'create_table_with_constraints', seqid) end + def process_drop_constraint(seqid, iprot, oprot) + args = read_args(iprot, Drop_constraint_args) + result = Drop_constraint_result.new() + begin + @handler.drop_constraint(args.dbname, args.tablename, args.constraintname) + rescue ::NoSuchObjectException => o1 + result.o1 = o1 + rescue ::MetaException => o3 + result.o3 = o3 + end + write_result(result, oprot, 'drop_constraint', seqid) + end + def process_drop_table(seqid, iprot, oprot) args = read_args(iprot, Drop_table_args) result = Drop_table_result.new() @@ -4954,6 +4983,44 @@ module ThriftHiveMetastore ::Thrift::Struct.generate_accessors self end + class Drop_constraint_args + include ::Thrift::Struct, ::Thrift::Struct_Union + DBNAME = 1 + TABLENAME = 2 + CONSTRAINTNAME = 3 + + FIELDS = { + DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbname'}, + TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tablename'}, + CONSTRAINTNAME => {:type => ::Thrift::Types::STRING, :name => 'constraintname'} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Drop_constraint_result + include ::Thrift::Struct, ::Thrift::Struct_Union + O1 = 1 + O3 = 2 + + FIELDS = { + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::NoSuchObjectException}, + O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + class Drop_table_args include ::Thrift::Struct, ::Thrift::Struct_Union DBNAME = 1 diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index 4ada9c1..4dcfbb2 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -1483,6 +1483,32 @@ public void create_table_with_constraints(final Table tbl, endFunction("create_table", success, ex, tbl.getTableName()); } } + + @Override + public void drop_constraint(String dbName, String tableName, String constraintName) + throws MetaException, InvalidObjectException { + startFunction("drop_constraint", ": " + constraintName.toString()); + boolean success = false; + Exception ex = null; + try { + getMS().dropConstraint(dbName, tableName, constraintName); + success = true; + } catch (NoSuchObjectException e) { + ex = e; + throw new InvalidObjectException(e.getMessage()); + } catch (Exception e) { + ex = e; + if (e instanceof MetaException) { + throw (MetaException) e; + } else if (e instanceof InvalidObjectException) { + throw (InvalidObjectException) e; + } else { + throw newMetaException(e); + } + } finally { + endFunction("drop_constraint", success, ex, constraintName); + } + } private boolean is_table_exists(RawStore ms, String dbname, String name) throws MetaException { return (ms.getTable(dbname, name) != null); diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index 7d37d07..814ec6e 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -765,6 +765,11 @@ public void createTableWithConstraints(Table tbl, } } + @Override + public void dropConstraint(String dbName, String tableName, String constraintName) throws + NoSuchObjectException, MetaException, TException { + client.drop_constraint(dbName, tableName, constraintName); + } /** * @param type diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index c900a2d..3965475 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -1570,4 +1570,7 @@ void createTableWithConstraints( List primaryKeys, List foreignKeys) throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException; + void dropConstraint(String dbName, String tableName, String constraintName) throws + MetaException, NoSuchObjectException, TException; + } diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java index f651a13..5c49be9 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -1025,7 +1025,8 @@ public boolean dropTable(String dbName, String tableName) throws MetaException, " table " + tableName + " record to delete"); } - List tabConstraints = listAllTableConstraints(dbName, tableName); + List tabConstraints = listAllTableConstraintsWithOptionalConstraintName( + dbName, tableName, null); if (tabConstraints != null && tabConstraints.size() > 0) { pm.deletePersistentAll(tabConstraints); } @@ -1043,19 +1044,27 @@ public boolean dropTable(String dbName, String tableName) throws MetaException, return success; } - private List listAllTableConstraints(String dbName, String tableName) { + private List listAllTableConstraintsWithOptionalConstraintName + (String dbName, String tableName, String constraintname) { List mConstraints = null; List constraintNames = new ArrayList(); Query query = null; try { query = pm.newQuery("select constraintName from org.apache.hadoop.hive.metastore.model.MConstraint where " - + "(parentTable.tableName == ptblname && parentTable.database.name == pdbname) || " - + "(childTable != null && childTable.tableName == ctblname && childTable.database.name == cdbname)"); + + "((parentTable.tableName == ptblname && parentTable.database.name == pdbname) || " + + "(childTable != null && childTable.tableName == ctblname && " + + "childTable.database.name == cdbname)) " + (constraintname != null ? + " && constraintName == constraintname" : "")); query.declareParameters("java.lang.String ptblname, java.lang.String pdbname," - + "java.lang.String ctblname, java.lang.String cdbname"); - Collection constraintNamesColl = (Collection) query. - executeWithArray(tableName, dbName, tableName, dbName); + + "java.lang.String ctblname, java.lang.String cdbname" + + (constraintname != null ? ", java.lang.String constraintname" : "")); + Collection constraintNamesColl = + constraintname != null ? + ((Collection) query. + executeWithArray(tableName, dbName, tableName, dbName, constraintname)): + ((Collection) query. + executeWithArray(tableName, dbName, tableName, dbName)); for (Iterator i = constraintNamesColl.iterator(); i.hasNext();) { String currName = (String) i.next(); constraintNames.add(currName); @@ -8389,4 +8398,27 @@ private String getPrimaryKeyConstraintName(String db_name, String tbl_name) thro return foreignKeys; } + @Override + public void dropConstraint(String dbName, String tableName, + String constraintName) throws NoSuchObjectException { + boolean success = false; + try { + openTransaction(); + + List tabConstraints = listAllTableConstraintsWithOptionalConstraintName( + dbName, tableName, constraintName); + if (tabConstraints != null && tabConstraints.size() > 0) { + pm.deletePersistentAll(tabConstraints); + } else { + throw new NoSuchObjectException("The constraint: " + constraintName + + " does not exist for the associated table: " + dbName + "." + tableName); + } + success = commitTransaction(); + } finally { + if (!success) { + rollbackTransaction(); + } + } + } + } diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java index 100c396..06b8135 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java @@ -675,4 +675,6 @@ void getFileMetadataByExpr(List fileIds, FileMetadataExprType type, byte[] void createTableWithConstraints(Table tbl, List primaryKeys, List foreignKeys) throws InvalidObjectException, MetaException; + + void dropConstraint(String dbName, String tableName, String constraintName) throws NoSuchObjectException; } diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java index d4e5da4..ec5b92c 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java @@ -2615,4 +2615,10 @@ public void createTableWithConstraints(Table tbl, throws InvalidObjectException, MetaException { // TODO Auto-generated method stub } + + @Override + public void dropConstraint(String dbName, String tableName, + String constraintName) throws NoSuchObjectException { + // TODO Auto-generated method stub + } } diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java b/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java index 86e7bea..63fcb28 100644 --- a/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java +++ b/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java @@ -844,4 +844,10 @@ public void createTableWithConstraints(Table tbl, throws InvalidObjectException, MetaException { // TODO Auto-generated method stub } + + @Override + public void dropConstraint(String dbName, String tableName, + String constraintName) throws NoSuchObjectException { + // TODO Auto-generated method stub + } } diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java b/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java index 5b32f00..386c70a 100644 --- a/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java +++ b/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java @@ -860,6 +860,12 @@ public void createTableWithConstraints(Table tbl, throws InvalidObjectException, MetaException { // TODO Auto-generated method stub } + + @Override + public void dropConstraint(String dbName, String tableName, + String constraintName) throws NoSuchObjectException { + // TODO Auto-generated method stub + } } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java index 39a1efc..d6b0644 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java @@ -3242,11 +3242,11 @@ private int alterTable(Hive db, AlterTableDesc alterTbl) throws HiveException { if (allPartitions != null) { // Alter all partitions for (Partition part : allPartitions) { - alterTableOrSinglePartition(alterTbl, tbl, part); + alterTableOrSinglePartition(alterTbl, tbl, part, db); } } else { // Just alter the table - alterTableOrSinglePartition(alterTbl, tbl, null); + alterTableOrSinglePartition(alterTbl, tbl, null, db); } if (allPartitions == null) { @@ -3295,7 +3295,7 @@ private boolean isSchemaEvolutionEnabled(Table tbl) { return false; } - private int alterTableOrSinglePartition(AlterTableDesc alterTbl, Table tbl, Partition part) + private int alterTableOrSinglePartition(AlterTableDesc alterTbl, Table tbl, Partition part, Hive db) throws HiveException { if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.RENAME) { @@ -3606,7 +3606,16 @@ private int alterTableOrSinglePartition(AlterTableDesc alterTbl, Table tbl, Part } tbl.setNumBuckets(alterTbl.getNumberBuckets()); } - } else { + } else if (alterTbl.getOp() == AlterTableTypes.DROPCONSTRAINT) { + try { + db.dropConstraint(Utilities.getDatabaseName(alterTbl.getOldName()), + Utilities.getTableName(alterTbl.getOldName()), + alterTbl.getConstraintName()); + } catch (NoSuchObjectException e) { + throw new HiveException(e); + } + } + else { throw new HiveException(ErrorMsg.UNSUPPORTED_ALTER_TBL_OP, alterTbl.getOp().toString()); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java b/ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java index 515f8b2..2194a6d 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java @@ -203,7 +203,8 @@ public static WriteType determineAlterTableWriteType(AlterTableDesc.AlterTableTy case ADDCOLS: case RENAME: case TRUNCATE: - case MERGEFILES: return WriteType.DDL_EXCLUSIVE; + case MERGEFILES: + case DROPCONSTRAINT: return WriteType.DDL_EXCLUSIVE; case ADDPARTITION: case ADDSERDEPROPS: diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java index 4d9c3d2..de9e196 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java @@ -85,6 +85,7 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.FireEventRequest; import org.apache.hadoop.hive.metastore.api.FireEventRequestData; +import org.apache.hadoop.hive.metastore.api.ForeignKeysRequest; import org.apache.hadoop.hive.metastore.api.Function; import org.apache.hadoop.hive.metastore.api.GetOpenTxnsInfoResponse; import org.apache.hadoop.hive.metastore.api.GetRoleGrantsForPrincipalRequest; @@ -99,6 +100,7 @@ import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; import org.apache.hadoop.hive.metastore.api.Order; +import org.apache.hadoop.hive.metastore.api.PrimaryKeysRequest; import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet; import org.apache.hadoop.hive.metastore.api.PrincipalType; import org.apache.hadoop.hive.metastore.api.PrivilegeBag; @@ -3604,4 +3606,13 @@ public long getPermanenFunctionsChangeVersion() throws HiveException { } } + public void dropConstraint(String dbName, String tableName, String constraintName) + throws HiveException, NoSuchObjectException { + try { + getMSC().dropConstraint(dbName, tableName, constraintName); + } catch (Exception e) { + throw new HiveException(e); + } + } + }; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java index 04e2a41..4a6617f 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java @@ -26,7 +26,6 @@ import org.slf4j.LoggerFactory; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.hive.common.FileUtils; import org.apache.hadoop.hive.common.JavaUtils; import org.apache.hadoop.hive.common.StatsSetupConst; import org.apache.hadoop.hive.conf.HiveConf; @@ -88,7 +87,6 @@ import org.apache.hadoop.hive.ql.plan.ColumnStatsUpdateWork; import org.apache.hadoop.hive.ql.plan.CreateDatabaseDesc; import org.apache.hadoop.hive.ql.plan.CreateIndexDesc; -import org.apache.hadoop.hive.ql.plan.DDLDesc; import org.apache.hadoop.hive.ql.plan.DDLWork; import org.apache.hadoop.hive.ql.plan.DescDatabaseDesc; import org.apache.hadoop.hive.ql.plan.DescFunctionDesc; @@ -321,6 +319,8 @@ public void analyzeInternal(ASTNode input) throws SemanticException { analyzeAlterTableCompact(ast, tableName, partSpec); } else if(ast.getToken().getType() == HiveParser.TOK_ALTERTABLE_UPDATECOLSTATS){ analyzeAlterTableUpdateStats(ast, tableName, partSpec); + } else if(ast.getToken().getType() == HiveParser.TOK_ALTERTABLE_DROPCONSTRAINT) { + analyzeAlterTableDropConstraint(ast, tableName); } break; } @@ -1740,6 +1740,15 @@ private void analyzeAlterTableCompact(ASTNode ast, String tableName, rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc), conf)); } + private void analyzeAlterTableDropConstraint(ASTNode ast, String tableName) + throws SemanticException { + String dropConstraintName = unescapeIdentifier(ast.getChild(0).getText()); + AlterTableDesc alterTblDesc = new AlterTableDesc(tableName, dropConstraintName); + + rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), + alterTblDesc), conf)); + } + static HashMap getProps(ASTNode prop) { // Must be deterministic order map for consistent q-test output across Java versions HashMap mapProp = new LinkedHashMap(); diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g index 6531b03..2c66396 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g @@ -179,6 +179,7 @@ TOK_ALTERTABLE_SKEWED_LOCATION; TOK_ALTERTABLE_BUCKETS; TOK_ALTERTABLE_CLUSTER_SORT; TOK_ALTERTABLE_COMPACT; +TOK_ALTERTABLE_DROPCONSTRAINT; TOK_ALTERINDEX_REBUILD; TOK_ALTERINDEX_PROPERTIES; TOK_MSCK; @@ -1040,6 +1041,7 @@ alterTableStatementSuffix | alterStatementSuffixSkewedby | alterStatementSuffixExchangePartition | alterStatementPartitionKeyType + | alterStatementSuffixDropConstraint | partitionSpec? alterTblPartitionStatementSuffix -> alterTblPartitionStatementSuffix partitionSpec? ; @@ -1129,6 +1131,13 @@ alterStatementSuffixAddCol -> ^(TOK_ALTERTABLE_REPLACECOLS columnNameTypeList restrictOrCascade?) ; +alterStatementSuffixDropConstraint +@init { pushMsg("drop constraint statement", state); } +@after { popMsg(state); } + : KW_DROP KW_CONSTRAINT cName=identifier + ->^(TOK_ALTERTABLE_DROPCONSTRAINT $cName) + ; + alterStatementSuffixRenameCol @init { pushMsg("rename column name", state); } @after { popMsg(state); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java index fb8a33c..7b83381 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java @@ -62,6 +62,7 @@ commandType.put(HiveParser.TOK_ALTERTABLE_PROPERTIES, HiveOperation.ALTERTABLE_PROPERTIES); commandType.put(HiveParser.TOK_ALTERTABLE_DROPPROPERTIES, HiveOperation.ALTERTABLE_PROPERTIES); commandType.put(HiveParser.TOK_ALTERTABLE_EXCHANGEPARTITION, HiveOperation.ALTERTABLE_EXCHANGEPARTITION); + commandType.put(HiveParser.TOK_ALTERTABLE_DROPCONSTRAINT, HiveOperation.ALTERTABLE_DROPCONSTRAINT); commandType.put(HiveParser.TOK_SHOWDATABASES, HiveOperation.SHOWDATABASES); commandType.put(HiveParser.TOK_SHOWTABLES, HiveOperation.SHOWTABLES); commandType.put(HiveParser.TOK_SHOWCOLUMNS, HiveOperation.SHOWCOLUMNS); @@ -195,6 +196,7 @@ public static BaseSemanticAnalyzer get(QueryState queryState, ASTNode tree) case HiveParser.TOK_ALTERTABLE_DROPPROPERTIES: case HiveParser.TOK_ALTERTABLE_EXCHANGEPARTITION: case HiveParser.TOK_ALTERTABLE_SKEWED: + case HiveParser.TOK_ALTERTABLE_DROPCONSTRAINT: queryState.setCommandType(commandType.get(child.getType())); return new DDLSemanticAnalyzer(queryState); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java index 4ba51ec..38d8d5a 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java @@ -56,7 +56,7 @@ DROPPARTITION("drop partition"), RENAMEPARTITION("rename partition"), ADDSKEWEDBY("add skew column"), ALTERSKEWEDLOCATION("alter skew location"), ALTERBUCKETNUM("alter bucket number"), ALTERPARTITION("alter partition"), COMPACT("compact"), - TRUNCATE("truncate"), MERGEFILES("merge files"); + TRUNCATE("truncate"), MERGEFILES("merge files"), DROPCONSTRAINT("drop constraint"); ; private final String name; @@ -116,6 +116,7 @@ boolean isTurnOffSorting = false; boolean isCascade = false; EnvironmentContext environmentContext; + String dropConstraintName; public AlterTableDesc() { } @@ -263,6 +264,12 @@ public AlterTableDesc(String tableName, HashMap partSpec, int nu this.numberBuckets = numBuckets; } + public AlterTableDesc(String tableName, String dropConstraintName) { + this.oldName = tableName; + this.dropConstraintName = dropConstraintName; + op = AlterTableTypes.DROPCONSTRAINT; + } + @Explain(displayName = "new columns", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED }) public List getNewColsString() { return Utilities.getFieldSchemaString(getNewCols()); @@ -408,6 +415,22 @@ public String getStorageHandler() { } /** + * @return the drop constraint name of the table + */ + @Explain(displayName = "drop constraint name", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED }) + public String getConstraintName() { + return dropConstraintName; + } + + /** + * @param constraintName + * the dropConstraintName to set + */ + public void setDropConstraintName(String constraintName) { + this.dropConstraintName = constraintName; + } + + /** * @param storageHandler * the storage handler to set */ diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java index 188cd6f..5774f68 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java @@ -115,6 +115,7 @@ new Privilege[] {Privilege.ALTER_DATA}, null), ALTERTABLE_PARTCOLTYPE("ALTERTABLE_PARTCOLTYPE", new Privilege[] { Privilege.SELECT }, new Privilege[] { Privilege.ALTER_DATA }), ALTERTABLE_EXCHANGEPARTITION("ALTERTABLE_EXCHANGEPARTITION", null, null), + ALTERTABLE_DROPCONSTRAINT("ALTERTABLE_DROPCONSTRAINT", null, null), ALTERVIEW_RENAME("ALTERVIEW_RENAME", new Privilege[] {Privilege.ALTER_METADATA}, null), ALTERVIEW_AS("ALTERVIEW_AS", new Privilege[] {Privilege.ALTER_METADATA}, null), ALTERTABLE_COMPACT("ALTERTABLE_COMPACT", new Privilege[]{Privilege.SELECT}, new Privilege[]{Privilege.ALTER_DATA}), diff --git a/ql/src/test/queries/clientnegative/drop_invalid_constraint1.q b/ql/src/test/queries/clientnegative/drop_invalid_constraint1.q new file mode 100644 index 0000000..2055f9e --- /dev/null +++ b/ql/src/test/queries/clientnegative/drop_invalid_constraint1.q @@ -0,0 +1,3 @@ +CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate); +ALTER TABLE table1 DROP CONSTRAINT pk1; +ALTER TABLE table1 DROP CONSTRAINT pk1; diff --git a/ql/src/test/queries/clientnegative/drop_invalid_constraint2.q b/ql/src/test/queries/clientnegative/drop_invalid_constraint2.q new file mode 100644 index 0000000..d253617 --- /dev/null +++ b/ql/src/test/queries/clientnegative/drop_invalid_constraint2.q @@ -0,0 +1,2 @@ +CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate); +ALTER TABLE table1 DROP CONSTRAINT pk1; diff --git a/ql/src/test/queries/clientnegative/drop_invalid_constraint3.q b/ql/src/test/queries/clientnegative/drop_invalid_constraint3.q new file mode 100644 index 0000000..04eb1fb --- /dev/null +++ b/ql/src/test/queries/clientnegative/drop_invalid_constraint3.q @@ -0,0 +1,2 @@ +CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate); +ALTER TABLE table2 DROP CONSTRAINT pk2; diff --git a/ql/src/test/queries/clientnegative/drop_invalid_constraint4.q b/ql/src/test/queries/clientnegative/drop_invalid_constraint4.q new file mode 100644 index 0000000..3cf2d2a --- /dev/null +++ b/ql/src/test/queries/clientnegative/drop_invalid_constraint4.q @@ -0,0 +1,3 @@ +CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate); +CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable novalidate); +ALTER TABLE table1 DROP CONSTRAINT pk2; \ No newline at end of file diff --git a/ql/src/test/queries/clientpositive/create_with_constraints.q b/ql/src/test/queries/clientpositive/create_with_constraints.q index eef0c64..aedb99b 100644 --- a/ql/src/test/queries/clientpositive/create_with_constraints.q +++ b/ql/src/test/queries/clientpositive/create_with_constraints.q @@ -8,5 +8,11 @@ CREATE TABLE table6 (x string, y string, PRIMARY KEY (x) disable novalidate, FOR CONSTRAINT fk4 FOREIGN KEY (y) REFERENCES table1(a) DISABLE NOVALIDATE); CREATE TABLE table7 (a STRING, b STRING, primary key (a) disable novalidate rely); CREATE TABLE table8 (a STRING, b STRING, constraint pk8 primary key (a) disable novalidate norely); +CREATE TABLE table9 (a STRING, b STRING, primary key (a, b) disable novalidate rely); +CREATE TABLE table10 (a STRING, b STRING, constraint pk10 primary key (a) disable novalidate norely, foreign key (a, b) references table9(a, b) disable novalidate); +CREATE TABLE table11 (a STRING, b STRING, c STRING, constraint pk11 primary key (a) disable novalidate rely, foreign key (a, b) references table9(a, b) disable novalidate, +foreign key (c) references table4(x) disable novalidate); - +ALTER TABLE table2 DROP CONSTRAINT pk1; +ALTER TABLE table3 DROP CONSTRAINT fk1; +ALTER TABLE table6 DROP CONSTRAINT fk4; diff --git a/ql/src/test/results/clientnegative/drop_invalid_constraint1.q.out b/ql/src/test/results/clientnegative/drop_invalid_constraint1.q.out new file mode 100644 index 0000000..042827f --- /dev/null +++ b/ql/src/test/results/clientnegative/drop_invalid_constraint1.q.out @@ -0,0 +1,17 @@ +PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@table1 +POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@table1 +PREHOOK: query: ALTER TABLE table1 DROP CONSTRAINT pk1 +PREHOOK: type: ALTERTABLE_DROPCONSTRAINT +POSTHOOK: query: ALTER TABLE table1 DROP CONSTRAINT pk1 +POSTHOOK: type: ALTERTABLE_DROPCONSTRAINT +POSTHOOK: Input: default@table1 +POSTHOOK: Output: default@table1 +PREHOOK: query: ALTER TABLE table1 DROP CONSTRAINT pk1 +PREHOOK: type: ALTERTABLE_DROPCONSTRAINT +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. InvalidObjectException(message:The constraint: pk1 does not exist for the associated table: default.table1) diff --git a/ql/src/test/results/clientnegative/drop_invalid_constraint2.q.out b/ql/src/test/results/clientnegative/drop_invalid_constraint2.q.out new file mode 100644 index 0000000..5dae7c2 --- /dev/null +++ b/ql/src/test/results/clientnegative/drop_invalid_constraint2.q.out @@ -0,0 +1,11 @@ +PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@table2 +POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@table2 +PREHOOK: query: ALTER TABLE table1 DROP CONSTRAINT pk1 +PREHOOK: type: ALTERTABLE_DROPCONSTRAINT +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Table not found table1 diff --git a/ql/src/test/results/clientnegative/drop_invalid_constraint3.q.out b/ql/src/test/results/clientnegative/drop_invalid_constraint3.q.out new file mode 100644 index 0000000..9c60e94 --- /dev/null +++ b/ql/src/test/results/clientnegative/drop_invalid_constraint3.q.out @@ -0,0 +1,11 @@ +PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@table2 +POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@table2 +PREHOOK: query: ALTER TABLE table2 DROP CONSTRAINT pk2 +PREHOOK: type: ALTERTABLE_DROPCONSTRAINT +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. InvalidObjectException(message:The constraint: pk2 does not exist for the associated table: default.table2) diff --git a/ql/src/test/results/clientnegative/drop_invalid_constraint4.q.out b/ql/src/test/results/clientnegative/drop_invalid_constraint4.q.out new file mode 100644 index 0000000..1d93c42 --- /dev/null +++ b/ql/src/test/results/clientnegative/drop_invalid_constraint4.q.out @@ -0,0 +1,19 @@ +PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@table1 +POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@table1 +PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable novalidate) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@table2 +POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable novalidate) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@table2 +PREHOOK: query: ALTER TABLE table1 DROP CONSTRAINT pk2 +PREHOOK: type: ALTERTABLE_DROPCONSTRAINT +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. InvalidObjectException(message:The constraint: pk2 does not exist for the associated table: default.table1) diff --git a/ql/src/test/results/clientpositive/create_with_constraints.q.out b/ql/src/test/results/clientpositive/create_with_constraints.q.out index 5cf8d83..b21a7dd 100644 --- a/ql/src/test/results/clientpositive/create_with_constraints.q.out +++ b/ql/src/test/results/clientpositive/create_with_constraints.q.out @@ -66,3 +66,47 @@ POSTHOOK: query: CREATE TABLE table8 (a STRING, b STRING, constraint pk8 primary POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@table8 +PREHOOK: query: CREATE TABLE table9 (a STRING, b STRING, primary key (a, b) disable novalidate rely) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@table9 +POSTHOOK: query: CREATE TABLE table9 (a STRING, b STRING, primary key (a, b) disable novalidate rely) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@table9 +PREHOOK: query: CREATE TABLE table10 (a STRING, b STRING, constraint pk10 primary key (a) disable novalidate norely, foreign key (a, b) references table9(a, b) disable novalidate) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@table10 +POSTHOOK: query: CREATE TABLE table10 (a STRING, b STRING, constraint pk10 primary key (a) disable novalidate norely, foreign key (a, b) references table9(a, b) disable novalidate) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@table10 +PREHOOK: query: CREATE TABLE table11 (a STRING, b STRING, c STRING, constraint pk11 primary key (a) disable novalidate rely, foreign key (a, b) references table9(a, b) disable novalidate, +foreign key (c) references table4(x) disable novalidate) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@table11 +POSTHOOK: query: CREATE TABLE table11 (a STRING, b STRING, c STRING, constraint pk11 primary key (a) disable novalidate rely, foreign key (a, b) references table9(a, b) disable novalidate, +foreign key (c) references table4(x) disable novalidate) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@table11 +PREHOOK: query: ALTER TABLE table2 DROP CONSTRAINT pk1 +PREHOOK: type: ALTERTABLE_DROPCONSTRAINT +POSTHOOK: query: ALTER TABLE table2 DROP CONSTRAINT pk1 +POSTHOOK: type: ALTERTABLE_DROPCONSTRAINT +POSTHOOK: Input: default@table2 +POSTHOOK: Output: default@table2 +PREHOOK: query: ALTER TABLE table3 DROP CONSTRAINT fk1 +PREHOOK: type: ALTERTABLE_DROPCONSTRAINT +POSTHOOK: query: ALTER TABLE table3 DROP CONSTRAINT fk1 +POSTHOOK: type: ALTERTABLE_DROPCONSTRAINT +POSTHOOK: Input: default@table3 +POSTHOOK: Output: default@table3 +PREHOOK: query: ALTER TABLE table6 DROP CONSTRAINT fk4 +PREHOOK: type: ALTERTABLE_DROPCONSTRAINT +POSTHOOK: query: ALTER TABLE table6 DROP CONSTRAINT fk4 +POSTHOOK: type: ALTERTABLE_DROPCONSTRAINT +POSTHOOK: Input: default@table6 +POSTHOOK: Output: default@table6 diff --git a/service/src/gen/thrift/gen-py/__init__.py b/service/src/gen/thrift/gen-py/__init__.py deleted file mode 100644 index e69de29..0000000