diff --git metastore/if/hive_metastore.thrift metastore/if/hive_metastore.thrift index c8b58bd..e4ff6d7 100755 --- metastore/if/hive_metastore.thrift +++ metastore/if/hive_metastore.thrift @@ -676,6 +676,9 @@ service ThriftHiveMetastore extends fb303.FacebookService list list_privileges(1:string principal_name, 2:PrincipalType principal_type, 3: HiveObjectRef hiveObject) throws(1:MetaException o1) + list list_privileges_for_auth(1:HiveObjectRef hiveObject, 2:string user_name, + 3: list group_names) throws(1:MetaException o1) + bool grant_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1) bool revoke_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1) diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp index 7faa04c..9277bbe 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp @@ -19873,6 +19873,280 @@ uint32_t ThriftHiveMetastore_list_privileges_presult::read(::apache::thrift::pro return xfer; } +uint32_t ThriftHiveMetastore_list_privileges_for_auth_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->hiveObject.read(iprot); + this->__isset.hiveObject = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->user_name); + this->__isset.user_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->group_names.clear(); + uint32_t _size696; + ::apache::thrift::protocol::TType _etype699; + xfer += iprot->readListBegin(_etype699, _size696); + this->group_names.resize(_size696); + uint32_t _i700; + for (_i700 = 0; _i700 < _size696; ++_i700) + { + xfer += iprot->readString(this->group_names[_i700]); + } + xfer += iprot->readListEnd(); + } + this->__isset.group_names = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_list_privileges_for_auth_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_list_privileges_for_auth_args"); + + xfer += oprot->writeFieldBegin("hiveObject", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->hiveObject.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("user_name", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->user_name); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("group_names", ::apache::thrift::protocol::T_LIST, 3); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->group_names.size())); + std::vector ::const_iterator _iter701; + for (_iter701 = this->group_names.begin(); _iter701 != this->group_names.end(); ++_iter701) + { + xfer += oprot->writeString((*_iter701)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_list_privileges_for_auth_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_list_privileges_for_auth_pargs"); + + xfer += oprot->writeFieldBegin("hiveObject", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->hiveObject)).write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("user_name", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString((*(this->user_name))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("group_names", ::apache::thrift::protocol::T_LIST, 3); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast((*(this->group_names)).size())); + std::vector ::const_iterator _iter702; + for (_iter702 = (*(this->group_names)).begin(); _iter702 != (*(this->group_names)).end(); ++_iter702) + { + xfer += oprot->writeString((*_iter702)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_list_privileges_for_auth_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->success.clear(); + uint32_t _size703; + ::apache::thrift::protocol::TType _etype706; + xfer += iprot->readListBegin(_etype706, _size703); + this->success.resize(_size703); + uint32_t _i707; + for (_i707 = 0; _i707 < _size703; ++_i707) + { + xfer += iprot->readString(this->success[_i707]); + } + xfer += iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_list_privileges_for_auth_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftHiveMetastore_list_privileges_for_auth_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->success.size())); + std::vector ::const_iterator _iter708; + for (_iter708 = this->success.begin(); _iter708 != this->success.end(); ++_iter708) + { + xfer += oprot->writeString((*_iter708)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.o1) { + xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->o1.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_list_privileges_for_auth_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + (*(this->success)).clear(); + uint32_t _size709; + ::apache::thrift::protocol::TType _etype712; + xfer += iprot->readListBegin(_etype712, _size709); + (*(this->success)).resize(_size709); + uint32_t _i713; + for (_i713 = 0; _i713 < _size709; ++_i713) + { + xfer += iprot->readString((*(this->success))[_i713]); + } + xfer += iprot->readListEnd(); + } + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + uint32_t ThriftHiveMetastore_grant_privileges_args::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; @@ -20269,14 +20543,14 @@ uint32_t ThriftHiveMetastore_set_ugi_args::read(::apache::thrift::protocol::TPro if (ftype == ::apache::thrift::protocol::T_LIST) { { this->group_names.clear(); - uint32_t _size696; - ::apache::thrift::protocol::TType _etype699; - xfer += iprot->readListBegin(_etype699, _size696); - this->group_names.resize(_size696); - uint32_t _i700; - for (_i700 = 0; _i700 < _size696; ++_i700) + uint32_t _size714; + ::apache::thrift::protocol::TType _etype717; + xfer += iprot->readListBegin(_etype717, _size714); + this->group_names.resize(_size714); + uint32_t _i718; + for (_i718 = 0; _i718 < _size714; ++_i718) { - xfer += iprot->readString(this->group_names[_i700]); + xfer += iprot->readString(this->group_names[_i718]); } xfer += iprot->readListEnd(); } @@ -20308,10 +20582,10 @@ uint32_t ThriftHiveMetastore_set_ugi_args::write(::apache::thrift::protocol::TPr xfer += oprot->writeFieldBegin("group_names", ::apache::thrift::protocol::T_LIST, 2); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->group_names.size())); - std::vector ::const_iterator _iter701; - for (_iter701 = this->group_names.begin(); _iter701 != this->group_names.end(); ++_iter701) + std::vector ::const_iterator _iter719; + for (_iter719 = this->group_names.begin(); _iter719 != this->group_names.end(); ++_iter719) { - xfer += oprot->writeString((*_iter701)); + xfer += oprot->writeString((*_iter719)); } xfer += oprot->writeListEnd(); } @@ -20333,10 +20607,10 @@ uint32_t ThriftHiveMetastore_set_ugi_pargs::write(::apache::thrift::protocol::TP xfer += oprot->writeFieldBegin("group_names", ::apache::thrift::protocol::T_LIST, 2); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast((*(this->group_names)).size())); - std::vector ::const_iterator _iter702; - for (_iter702 = (*(this->group_names)).begin(); _iter702 != (*(this->group_names)).end(); ++_iter702) + std::vector ::const_iterator _iter720; + for (_iter720 = (*(this->group_names)).begin(); _iter720 != (*(this->group_names)).end(); ++_iter720) { - xfer += oprot->writeString((*_iter702)); + xfer += oprot->writeString((*_iter720)); } xfer += oprot->writeListEnd(); } @@ -20371,14 +20645,14 @@ uint32_t ThriftHiveMetastore_set_ugi_result::read(::apache::thrift::protocol::TP if (ftype == ::apache::thrift::protocol::T_LIST) { { this->success.clear(); - uint32_t _size703; - ::apache::thrift::protocol::TType _etype706; - xfer += iprot->readListBegin(_etype706, _size703); - this->success.resize(_size703); - uint32_t _i707; - for (_i707 = 0; _i707 < _size703; ++_i707) + uint32_t _size721; + ::apache::thrift::protocol::TType _etype724; + xfer += iprot->readListBegin(_etype724, _size721); + this->success.resize(_size721); + uint32_t _i725; + for (_i725 = 0; _i725 < _size721; ++_i725) { - xfer += iprot->readString(this->success[_i707]); + xfer += iprot->readString(this->success[_i725]); } xfer += iprot->readListEnd(); } @@ -20417,10 +20691,10 @@ uint32_t ThriftHiveMetastore_set_ugi_result::write(::apache::thrift::protocol::T xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->success.size())); - std::vector ::const_iterator _iter708; - for (_iter708 = this->success.begin(); _iter708 != this->success.end(); ++_iter708) + std::vector ::const_iterator _iter726; + for (_iter726 = this->success.begin(); _iter726 != this->success.end(); ++_iter726) { - xfer += oprot->writeString((*_iter708)); + xfer += oprot->writeString((*_iter726)); } xfer += oprot->writeListEnd(); } @@ -20459,14 +20733,14 @@ uint32_t ThriftHiveMetastore_set_ugi_presult::read(::apache::thrift::protocol::T if (ftype == ::apache::thrift::protocol::T_LIST) { { (*(this->success)).clear(); - uint32_t _size709; - ::apache::thrift::protocol::TType _etype712; - xfer += iprot->readListBegin(_etype712, _size709); - (*(this->success)).resize(_size709); - uint32_t _i713; - for (_i713 = 0; _i713 < _size709; ++_i713) + uint32_t _size727; + ::apache::thrift::protocol::TType _etype730; + xfer += iprot->readListBegin(_etype730, _size727); + (*(this->success)).resize(_size727); + uint32_t _i731; + for (_i731 = 0; _i731 < _size727; ++_i731) { - xfer += iprot->readString((*(this->success))[_i713]); + xfer += iprot->readString((*(this->success))[_i731]); } xfer += iprot->readListEnd(); } @@ -26284,6 +26558,69 @@ void ThriftHiveMetastoreClient::recv_list_privileges(std::vector & _return, const HiveObjectRef& hiveObject, const std::string& user_name, const std::vector & group_names) +{ + send_list_privileges_for_auth(hiveObject, user_name, group_names); + recv_list_privileges_for_auth(_return); +} + +void ThriftHiveMetastoreClient::send_list_privileges_for_auth(const HiveObjectRef& hiveObject, const std::string& user_name, const std::vector & group_names) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("list_privileges_for_auth", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_list_privileges_for_auth_pargs args; + args.hiveObject = &hiveObject; + args.user_name = &user_name; + args.group_names = &group_names; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void ThriftHiveMetastoreClient::recv_list_privileges_for_auth(std::vector & _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("list_privileges_for_auth") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + ThriftHiveMetastore_list_privileges_for_auth_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.o1) { + throw result.o1; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "list_privileges_for_auth failed: unknown result"); +} + bool ThriftHiveMetastoreClient::grant_privileges(const PrivilegeBag& privileges) { send_grant_privileges(privileges); @@ -31511,6 +31848,63 @@ void ThriftHiveMetastoreProcessor::process_list_privileges(int32_t seqid, ::apac } } +void ThriftHiveMetastoreProcessor::process_list_privileges_for_auth(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.list_privileges_for_auth", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftHiveMetastore.list_privileges_for_auth"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftHiveMetastore.list_privileges_for_auth"); + } + + ThriftHiveMetastore_list_privileges_for_auth_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftHiveMetastore.list_privileges_for_auth", bytes); + } + + ThriftHiveMetastore_list_privileges_for_auth_result result; + try { + iface_->list_privileges_for_auth(result.success, args.hiveObject, args.user_name, args.group_names); + result.__isset.success = true; + } catch (MetaException &o1) { + result.o1 = o1; + result.__isset.o1 = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftHiveMetastore.list_privileges_for_auth"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("list_privileges_for_auth", ::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.list_privileges_for_auth"); + } + + oprot->writeMessageBegin("list_privileges_for_auth", ::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.list_privileges_for_auth", bytes); + } +} + void ThriftHiveMetastoreProcessor::process_grant_privileges(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) { void* ctx = NULL; diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h index 4cfd70b..a1160a4 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h @@ -96,6 +96,7 @@ class ThriftHiveMetastoreIf : virtual public ::facebook::fb303::FacebookService virtual void list_roles(std::vector & _return, const std::string& principal_name, const PrincipalType::type principal_type) = 0; virtual void get_privilege_set(PrincipalPrivilegeSet& _return, const HiveObjectRef& hiveObject, const std::string& user_name, const std::vector & group_names) = 0; virtual void list_privileges(std::vector & _return, const std::string& principal_name, const PrincipalType::type principal_type, const HiveObjectRef& hiveObject) = 0; + virtual void list_privileges_for_auth(std::vector & _return, const HiveObjectRef& hiveObject, const std::string& user_name, const std::vector & group_names) = 0; virtual bool grant_privileges(const PrivilegeBag& privileges) = 0; virtual bool revoke_privileges(const PrivilegeBag& privileges) = 0; virtual void set_ugi(std::vector & _return, const std::string& user_name, const std::vector & group_names) = 0; @@ -389,6 +390,9 @@ class ThriftHiveMetastoreNull : virtual public ThriftHiveMetastoreIf , virtual p void list_privileges(std::vector & /* _return */, const std::string& /* principal_name */, const PrincipalType::type /* principal_type */, const HiveObjectRef& /* hiveObject */) { return; } + void list_privileges_for_auth(std::vector & /* _return */, const HiveObjectRef& /* hiveObject */, const std::string& /* user_name */, const std::vector & /* group_names */) { + return; + } bool grant_privileges(const PrivilegeBag& /* privileges */) { bool _return = false; return _return; @@ -11919,6 +11923,142 @@ class ThriftHiveMetastore_list_privileges_presult { }; +typedef struct _ThriftHiveMetastore_list_privileges_for_auth_args__isset { + _ThriftHiveMetastore_list_privileges_for_auth_args__isset() : hiveObject(false), user_name(false), group_names(false) {} + bool hiveObject; + bool user_name; + bool group_names; +} _ThriftHiveMetastore_list_privileges_for_auth_args__isset; + +class ThriftHiveMetastore_list_privileges_for_auth_args { + public: + + ThriftHiveMetastore_list_privileges_for_auth_args() : user_name() { + } + + virtual ~ThriftHiveMetastore_list_privileges_for_auth_args() throw() {} + + HiveObjectRef hiveObject; + std::string user_name; + std::vector group_names; + + _ThriftHiveMetastore_list_privileges_for_auth_args__isset __isset; + + void __set_hiveObject(const HiveObjectRef& val) { + hiveObject = val; + } + + void __set_user_name(const std::string& val) { + user_name = val; + } + + void __set_group_names(const std::vector & val) { + group_names = val; + } + + bool operator == (const ThriftHiveMetastore_list_privileges_for_auth_args & rhs) const + { + if (!(hiveObject == rhs.hiveObject)) + return false; + if (!(user_name == rhs.user_name)) + return false; + if (!(group_names == rhs.group_names)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_list_privileges_for_auth_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_list_privileges_for_auth_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftHiveMetastore_list_privileges_for_auth_pargs { + public: + + + virtual ~ThriftHiveMetastore_list_privileges_for_auth_pargs() throw() {} + + const HiveObjectRef* hiveObject; + const std::string* user_name; + const std::vector * group_names; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_list_privileges_for_auth_result__isset { + _ThriftHiveMetastore_list_privileges_for_auth_result__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_list_privileges_for_auth_result__isset; + +class ThriftHiveMetastore_list_privileges_for_auth_result { + public: + + ThriftHiveMetastore_list_privileges_for_auth_result() { + } + + virtual ~ThriftHiveMetastore_list_privileges_for_auth_result() throw() {} + + std::vector success; + MetaException o1; + + _ThriftHiveMetastore_list_privileges_for_auth_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_o1(const MetaException& val) { + o1 = val; + } + + bool operator == (const ThriftHiveMetastore_list_privileges_for_auth_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(o1 == rhs.o1)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_list_privileges_for_auth_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_list_privileges_for_auth_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_list_privileges_for_auth_presult__isset { + _ThriftHiveMetastore_list_privileges_for_auth_presult__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_list_privileges_for_auth_presult__isset; + +class ThriftHiveMetastore_list_privileges_for_auth_presult { + public: + + + virtual ~ThriftHiveMetastore_list_privileges_for_auth_presult() throw() {} + + std::vector * success; + MetaException o1; + + _ThriftHiveMetastore_list_privileges_for_auth_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + typedef struct _ThriftHiveMetastore_grant_privileges_args__isset { _ThriftHiveMetastore_grant_privileges_args__isset() : privileges(false) {} bool privileges; @@ -12887,6 +13027,9 @@ class ThriftHiveMetastoreClient : virtual public ThriftHiveMetastoreIf, public void list_privileges(std::vector & _return, const std::string& principal_name, const PrincipalType::type principal_type, const HiveObjectRef& hiveObject); void send_list_privileges(const std::string& principal_name, const PrincipalType::type principal_type, const HiveObjectRef& hiveObject); void recv_list_privileges(std::vector & _return); + void list_privileges_for_auth(std::vector & _return, const HiveObjectRef& hiveObject, const std::string& user_name, const std::vector & group_names); + void send_list_privileges_for_auth(const HiveObjectRef& hiveObject, const std::string& user_name, const std::vector & group_names); + void recv_list_privileges_for_auth(std::vector & _return); bool grant_privileges(const PrivilegeBag& privileges); void send_grant_privileges(const PrivilegeBag& privileges); bool recv_grant_privileges(); @@ -12995,6 +13138,7 @@ class ThriftHiveMetastoreProcessor : public ::facebook::fb303::FacebookServiceP void process_list_roles(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_privilege_set(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_list_privileges(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_list_privileges_for_auth(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_grant_privileges(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_revoke_privileges(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_set_ugi(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); @@ -13085,6 +13229,7 @@ class ThriftHiveMetastoreProcessor : public ::facebook::fb303::FacebookServiceP processMap_["list_roles"] = &ThriftHiveMetastoreProcessor::process_list_roles; processMap_["get_privilege_set"] = &ThriftHiveMetastoreProcessor::process_get_privilege_set; processMap_["list_privileges"] = &ThriftHiveMetastoreProcessor::process_list_privileges; + processMap_["list_privileges_for_auth"] = &ThriftHiveMetastoreProcessor::process_list_privileges_for_auth; processMap_["grant_privileges"] = &ThriftHiveMetastoreProcessor::process_grant_privileges; processMap_["revoke_privileges"] = &ThriftHiveMetastoreProcessor::process_revoke_privileges; processMap_["set_ugi"] = &ThriftHiveMetastoreProcessor::process_set_ugi; @@ -13891,6 +14036,16 @@ class ThriftHiveMetastoreMultiface : virtual public ThriftHiveMetastoreIf, publi return; } + void list_privileges_for_auth(std::vector & _return, const HiveObjectRef& hiveObject, const std::string& user_name, const std::vector & group_names) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->list_privileges_for_auth(_return, hiveObject, user_name, group_names); + } + ifaces_[i]->list_privileges_for_auth(_return, hiveObject, user_name, group_names); + return; + } + bool grant_privileges(const PrivilegeBag& privileges) { size_t sz = ifaces_.size(); size_t i = 0; diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp index ed3402a..5474990 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp @@ -422,6 +422,11 @@ class ThriftHiveMetastoreHandler : virtual public ThriftHiveMetastoreIf { printf("list_privileges\n"); } + void list_privileges_for_auth(std::vector & _return, const HiveObjectRef& hiveObject, const std::string& user_name, const std::vector & group_names) { + // Your implementation goes here + printf("list_privileges_for_auth\n"); + } + bool grant_privileges(const PrivilegeBag& privileges) { // Your implementation goes here printf("grant_privileges\n"); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java index e20aa18..4f25f60 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java @@ -198,6 +198,8 @@ public List list_privileges(String principal_name, PrincipalType principal_type, HiveObjectRef hiveObject) throws MetaException, org.apache.thrift.TException; + public List list_privileges_for_auth(HiveObjectRef hiveObject, String user_name, List group_names) throws MetaException, org.apache.thrift.TException; + public boolean grant_privileges(PrivilegeBag privileges) throws MetaException, org.apache.thrift.TException; public boolean revoke_privileges(PrivilegeBag privileges) throws MetaException, org.apache.thrift.TException; @@ -374,6 +376,8 @@ public void list_privileges(String principal_name, PrincipalType principal_type, HiveObjectRef hiveObject, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void list_privileges_for_auth(HiveObjectRef hiveObject, String user_name, List group_names, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void grant_privileges(PrivilegeBag privileges, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void revoke_privileges(PrivilegeBag privileges, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -2885,6 +2889,34 @@ public void send_list_privileges(String principal_name, PrincipalType principal_ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_privileges failed: unknown result"); } + public List list_privileges_for_auth(HiveObjectRef hiveObject, String user_name, List group_names) throws MetaException, org.apache.thrift.TException + { + send_list_privileges_for_auth(hiveObject, user_name, group_names); + return recv_list_privileges_for_auth(); + } + + public void send_list_privileges_for_auth(HiveObjectRef hiveObject, String user_name, List group_names) throws org.apache.thrift.TException + { + list_privileges_for_auth_args args = new list_privileges_for_auth_args(); + args.setHiveObject(hiveObject); + args.setUser_name(user_name); + args.setGroup_names(group_names); + sendBase("list_privileges_for_auth", args); + } + + public List recv_list_privileges_for_auth() throws MetaException, org.apache.thrift.TException + { + list_privileges_for_auth_result result = new list_privileges_for_auth_result(); + receiveBase(result, "list_privileges_for_auth"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.o1 != null) { + throw result.o1; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_privileges_for_auth failed: unknown result"); + } + public boolean grant_privileges(PrivilegeBag privileges) throws MetaException, org.apache.thrift.TException { send_grant_privileges(privileges); @@ -6017,6 +6049,44 @@ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apa } } + public void list_privileges_for_auth(HiveObjectRef hiveObject, String user_name, List group_names, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + list_privileges_for_auth_call method_call = new list_privileges_for_auth_call(hiveObject, user_name, group_names, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class list_privileges_for_auth_call extends org.apache.thrift.async.TAsyncMethodCall { + private HiveObjectRef hiveObject; + private String user_name; + private List group_names; + public list_privileges_for_auth_call(HiveObjectRef hiveObject, String user_name, List group_names, 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.hiveObject = hiveObject; + this.user_name = user_name; + this.group_names = group_names; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_privileges_for_auth", org.apache.thrift.protocol.TMessageType.CALL, 0)); + list_privileges_for_auth_args args = new list_privileges_for_auth_args(); + args.setHiveObject(hiveObject); + args.setUser_name(user_name); + args.setGroup_names(group_names); + args.write(prot); + prot.writeMessageEnd(); + } + + public List getResult() throws MetaException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_list_privileges_for_auth(); + } + } + public void grant_privileges(PrivilegeBag privileges, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); grant_privileges_call method_call = new grant_privileges_call(privileges, resultHandler, this, ___protocolFactory, ___transport); @@ -6308,6 +6378,7 @@ protected Processor(I iface, Map extends org.apache.thrift.ProcessFunction { + public list_privileges_for_auth() { + super("list_privileges_for_auth"); + } + + public list_privileges_for_auth_args getEmptyArgsInstance() { + return new list_privileges_for_auth_args(); + } + + protected boolean isOneway() { + return false; + } + + public list_privileges_for_auth_result getResult(I iface, list_privileges_for_auth_args args) throws org.apache.thrift.TException { + list_privileges_for_auth_result result = new list_privileges_for_auth_result(); + try { + result.success = iface.list_privileges_for_auth(args.hiveObject, args.user_name, args.group_names); + } catch (MetaException o1) { + result.o1 = o1; + } + return result; + } + } + public static class grant_privileges extends org.apache.thrift.ProcessFunction { public grant_privileges() { super("grant_privileges"); @@ -98865,18 +98960,1071 @@ public String getFieldName() { static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PrincipalPrivilegeSet.class))); + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PrincipalPrivilegeSet.class))); + tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_privilege_set_result.class, metaDataMap); + } + + public get_privilege_set_result() { + } + + public get_privilege_set_result( + PrincipalPrivilegeSet success, + MetaException o1) + { + this(); + this.success = success; + this.o1 = o1; + } + + /** + * Performs a deep copy on other. + */ + public get_privilege_set_result(get_privilege_set_result other) { + if (other.isSetSuccess()) { + this.success = new PrincipalPrivilegeSet(other.success); + } + if (other.isSetO1()) { + this.o1 = new MetaException(other.o1); + } + } + + public get_privilege_set_result deepCopy() { + return new get_privilege_set_result(this); + } + + @Override + public void clear() { + this.success = null; + this.o1 = null; + } + + public PrincipalPrivilegeSet getSuccess() { + return this.success; + } + + public void setSuccess(PrincipalPrivilegeSet success) { + this.success = success; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public MetaException getO1() { + return this.o1; + } + + public void setO1(MetaException o1) { + this.o1 = o1; + } + + public void unsetO1() { + this.o1 = null; + } + + /** Returns true if field o1 is set (has been assigned a value) and false otherwise */ + public boolean isSetO1() { + return this.o1 != null; + } + + public void setO1IsSet(boolean value) { + if (!value) { + this.o1 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((PrincipalPrivilegeSet)value); + } + break; + + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((MetaException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case O1: + return getO1(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + case O1: + return isSetO1(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof get_privilege_set_result) + return this.equals((get_privilege_set_result)that); + return false; + } + + public boolean equals(get_privilege_set_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_o1 = true && this.isSetO1(); + boolean that_present_o1 = true && that.isSetO1(); + if (this_present_o1 || that_present_o1) { + if (!(this_present_o1 && that_present_o1)) + return false; + if (!this.o1.equals(that.o1)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_success = true && (isSetSuccess()); + builder.append(present_success); + if (present_success) + builder.append(success); + + boolean present_o1 = true && (isSetO1()); + builder.append(present_o1); + if (present_o1) + builder.append(o1); + + return builder.toHashCode(); + } + + public int compareTo(get_privilege_set_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + get_privilege_set_result typedOther = (get_privilege_set_result)other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o1, typedOther.o1); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("get_privilege_set_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + 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 get_privilege_set_resultStandardSchemeFactory implements SchemeFactory { + public get_privilege_set_resultStandardScheme getScheme() { + return new get_privilege_set_resultStandardScheme(); + } + } + + private static class get_privilege_set_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, get_privilege_set_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new PrincipalPrivilegeSet(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // O1 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.o1 = new MetaException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, get_privilege_set_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.o1 != null) { + oprot.writeFieldBegin(O1_FIELD_DESC); + struct.o1.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class get_privilege_set_resultTupleSchemeFactory implements SchemeFactory { + public get_privilege_set_resultTupleScheme getScheme() { + return new get_privilege_set_resultTupleScheme(); + } + } + + private static class get_privilege_set_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, get_privilege_set_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetO1()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + if (struct.isSetO1()) { + struct.o1.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, get_privilege_set_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.success = new PrincipalPrivilegeSet(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.o1 = new MetaException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } + } + } + + } + + public static class list_privileges_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_privileges_args"); + + private static final org.apache.thrift.protocol.TField PRINCIPAL_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("principal_name", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField PRINCIPAL_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("principal_type", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField HIVE_OBJECT_FIELD_DESC = new org.apache.thrift.protocol.TField("hiveObject", org.apache.thrift.protocol.TType.STRUCT, (short)3); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new list_privileges_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new list_privileges_argsTupleSchemeFactory()); + } + + private String principal_name; // required + private PrincipalType principal_type; // required + private HiveObjectRef hiveObject; // 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 { + PRINCIPAL_NAME((short)1, "principal_name"), + /** + * + * @see PrincipalType + */ + PRINCIPAL_TYPE((short)2, "principal_type"), + HIVE_OBJECT((short)3, "hiveObject"); + + 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: // PRINCIPAL_NAME + return PRINCIPAL_NAME; + case 2: // PRINCIPAL_TYPE + return PRINCIPAL_TYPE; + case 3: // HIVE_OBJECT + return HIVE_OBJECT; + 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.PRINCIPAL_NAME, new org.apache.thrift.meta_data.FieldMetaData("principal_name", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PRINCIPAL_TYPE, new org.apache.thrift.meta_data.FieldMetaData("principal_type", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PrincipalType.class))); + tmpMap.put(_Fields.HIVE_OBJECT, new org.apache.thrift.meta_data.FieldMetaData("hiveObject", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HiveObjectRef.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_privileges_args.class, metaDataMap); + } + + public list_privileges_args() { + } + + public list_privileges_args( + String principal_name, + PrincipalType principal_type, + HiveObjectRef hiveObject) + { + this(); + this.principal_name = principal_name; + this.principal_type = principal_type; + this.hiveObject = hiveObject; + } + + /** + * Performs a deep copy on other. + */ + public list_privileges_args(list_privileges_args other) { + if (other.isSetPrincipal_name()) { + this.principal_name = other.principal_name; + } + if (other.isSetPrincipal_type()) { + this.principal_type = other.principal_type; + } + if (other.isSetHiveObject()) { + this.hiveObject = new HiveObjectRef(other.hiveObject); + } + } + + public list_privileges_args deepCopy() { + return new list_privileges_args(this); + } + + @Override + public void clear() { + this.principal_name = null; + this.principal_type = null; + this.hiveObject = null; + } + + public String getPrincipal_name() { + return this.principal_name; + } + + public void setPrincipal_name(String principal_name) { + this.principal_name = principal_name; + } + + public void unsetPrincipal_name() { + this.principal_name = null; + } + + /** Returns true if field principal_name is set (has been assigned a value) and false otherwise */ + public boolean isSetPrincipal_name() { + return this.principal_name != null; + } + + public void setPrincipal_nameIsSet(boolean value) { + if (!value) { + this.principal_name = null; + } + } + + /** + * + * @see PrincipalType + */ + public PrincipalType getPrincipal_type() { + return this.principal_type; + } + + /** + * + * @see PrincipalType + */ + public void setPrincipal_type(PrincipalType principal_type) { + this.principal_type = principal_type; + } + + public void unsetPrincipal_type() { + this.principal_type = null; + } + + /** Returns true if field principal_type is set (has been assigned a value) and false otherwise */ + public boolean isSetPrincipal_type() { + return this.principal_type != null; + } + + public void setPrincipal_typeIsSet(boolean value) { + if (!value) { + this.principal_type = null; + } + } + + public HiveObjectRef getHiveObject() { + return this.hiveObject; + } + + public void setHiveObject(HiveObjectRef hiveObject) { + this.hiveObject = hiveObject; + } + + public void unsetHiveObject() { + this.hiveObject = null; + } + + /** Returns true if field hiveObject is set (has been assigned a value) and false otherwise */ + public boolean isSetHiveObject() { + return this.hiveObject != null; + } + + public void setHiveObjectIsSet(boolean value) { + if (!value) { + this.hiveObject = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case PRINCIPAL_NAME: + if (value == null) { + unsetPrincipal_name(); + } else { + setPrincipal_name((String)value); + } + break; + + case PRINCIPAL_TYPE: + if (value == null) { + unsetPrincipal_type(); + } else { + setPrincipal_type((PrincipalType)value); + } + break; + + case HIVE_OBJECT: + if (value == null) { + unsetHiveObject(); + } else { + setHiveObject((HiveObjectRef)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case PRINCIPAL_NAME: + return getPrincipal_name(); + + case PRINCIPAL_TYPE: + return getPrincipal_type(); + + case HIVE_OBJECT: + return getHiveObject(); + + } + 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 PRINCIPAL_NAME: + return isSetPrincipal_name(); + case PRINCIPAL_TYPE: + return isSetPrincipal_type(); + case HIVE_OBJECT: + return isSetHiveObject(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof list_privileges_args) + return this.equals((list_privileges_args)that); + return false; + } + + public boolean equals(list_privileges_args that) { + if (that == null) + return false; + + boolean this_present_principal_name = true && this.isSetPrincipal_name(); + boolean that_present_principal_name = true && that.isSetPrincipal_name(); + if (this_present_principal_name || that_present_principal_name) { + if (!(this_present_principal_name && that_present_principal_name)) + return false; + if (!this.principal_name.equals(that.principal_name)) + return false; + } + + boolean this_present_principal_type = true && this.isSetPrincipal_type(); + boolean that_present_principal_type = true && that.isSetPrincipal_type(); + if (this_present_principal_type || that_present_principal_type) { + if (!(this_present_principal_type && that_present_principal_type)) + return false; + if (!this.principal_type.equals(that.principal_type)) + return false; + } + + boolean this_present_hiveObject = true && this.isSetHiveObject(); + boolean that_present_hiveObject = true && that.isSetHiveObject(); + if (this_present_hiveObject || that_present_hiveObject) { + if (!(this_present_hiveObject && that_present_hiveObject)) + return false; + if (!this.hiveObject.equals(that.hiveObject)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_principal_name = true && (isSetPrincipal_name()); + builder.append(present_principal_name); + if (present_principal_name) + builder.append(principal_name); + + boolean present_principal_type = true && (isSetPrincipal_type()); + builder.append(present_principal_type); + if (present_principal_type) + builder.append(principal_type.getValue()); + + boolean present_hiveObject = true && (isSetHiveObject()); + builder.append(present_hiveObject); + if (present_hiveObject) + builder.append(hiveObject); + + return builder.toHashCode(); + } + + public int compareTo(list_privileges_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + list_privileges_args typedOther = (list_privileges_args)other; + + lastComparison = Boolean.valueOf(isSetPrincipal_name()).compareTo(typedOther.isSetPrincipal_name()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPrincipal_name()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.principal_name, typedOther.principal_name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPrincipal_type()).compareTo(typedOther.isSetPrincipal_type()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPrincipal_type()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.principal_type, typedOther.principal_type); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetHiveObject()).compareTo(typedOther.isSetHiveObject()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHiveObject()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hiveObject, typedOther.hiveObject); + 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("list_privileges_args("); + boolean first = true; + + sb.append("principal_name:"); + if (this.principal_name == null) { + sb.append("null"); + } else { + sb.append(this.principal_name); + } + first = false; + if (!first) sb.append(", "); + sb.append("principal_type:"); + if (this.principal_type == null) { + sb.append("null"); + } else { + sb.append(this.principal_type); + } + first = false; + if (!first) sb.append(", "); + sb.append("hiveObject:"); + if (this.hiveObject == null) { + sb.append("null"); + } else { + sb.append(this.hiveObject); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (hiveObject != null) { + hiveObject.validate(); + } + } + + 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 list_privileges_argsStandardSchemeFactory implements SchemeFactory { + public list_privileges_argsStandardScheme getScheme() { + return new list_privileges_argsStandardScheme(); + } + } + + private static class list_privileges_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_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: // PRINCIPAL_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.principal_name = iprot.readString(); + struct.setPrincipal_nameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PRINCIPAL_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.principal_type = PrincipalType.findByValue(iprot.readI32()); + struct.setPrincipal_typeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // HIVE_OBJECT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.hiveObject = new HiveObjectRef(); + struct.hiveObject.read(iprot); + struct.setHiveObjectIsSet(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, list_privileges_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.principal_name != null) { + oprot.writeFieldBegin(PRINCIPAL_NAME_FIELD_DESC); + oprot.writeString(struct.principal_name); + oprot.writeFieldEnd(); + } + if (struct.principal_type != null) { + oprot.writeFieldBegin(PRINCIPAL_TYPE_FIELD_DESC); + oprot.writeI32(struct.principal_type.getValue()); + oprot.writeFieldEnd(); + } + if (struct.hiveObject != null) { + oprot.writeFieldBegin(HIVE_OBJECT_FIELD_DESC); + struct.hiveObject.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class list_privileges_argsTupleSchemeFactory implements SchemeFactory { + public list_privileges_argsTupleScheme getScheme() { + return new list_privileges_argsTupleScheme(); + } + } + + private static class list_privileges_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, list_privileges_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetPrincipal_name()) { + optionals.set(0); + } + if (struct.isSetPrincipal_type()) { + optionals.set(1); + } + if (struct.isSetHiveObject()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetPrincipal_name()) { + oprot.writeString(struct.principal_name); + } + if (struct.isSetPrincipal_type()) { + oprot.writeI32(struct.principal_type.getValue()); + } + if (struct.isSetHiveObject()) { + struct.hiveObject.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, list_privileges_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.principal_name = iprot.readString(); + struct.setPrincipal_nameIsSet(true); + } + if (incoming.get(1)) { + struct.principal_type = PrincipalType.findByValue(iprot.readI32()); + struct.setPrincipal_typeIsSet(true); + } + if (incoming.get(2)) { + struct.hiveObject = new HiveObjectRef(); + struct.hiveObject.read(iprot); + struct.setHiveObjectIsSet(true); + } + } + } + + } + + public static class list_privileges_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_privileges_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); + private static final org.apache.thrift.protocol.TField O1_FIELD_DESC = new org.apache.thrift.protocol.TField("o1", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new list_privileges_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new list_privileges_resultTupleSchemeFactory()); + } + + private List success; // required + private MetaException o1; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"), + O1((short)1, "o1"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + case 1: // O1 + return O1; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HiveObjectPrivilege.class)))); tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_privilege_set_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_privileges_result.class, metaDataMap); } - public get_privilege_set_result() { + public list_privileges_result() { } - public get_privilege_set_result( - PrincipalPrivilegeSet success, + public list_privileges_result( + List success, MetaException o1) { this(); @@ -98887,17 +100035,21 @@ public get_privilege_set_result( /** * Performs a deep copy on other. */ - public get_privilege_set_result(get_privilege_set_result other) { + public list_privileges_result(list_privileges_result other) { if (other.isSetSuccess()) { - this.success = new PrincipalPrivilegeSet(other.success); + List __this__success = new ArrayList(); + for (HiveObjectPrivilege other_element : other.success) { + __this__success.add(new HiveObjectPrivilege(other_element)); + } + this.success = __this__success; } if (other.isSetO1()) { this.o1 = new MetaException(other.o1); } } - public get_privilege_set_result deepCopy() { - return new get_privilege_set_result(this); + public list_privileges_result deepCopy() { + return new list_privileges_result(this); } @Override @@ -98906,11 +100058,26 @@ public void clear() { this.o1 = null; } - public PrincipalPrivilegeSet getSuccess() { + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(HiveObjectPrivilege elem) { + if (this.success == null) { + this.success = new ArrayList(); + } + this.success.add(elem); + } + + public List getSuccess() { return this.success; } - public void setSuccess(PrincipalPrivilegeSet success) { + public void setSuccess(List success) { this.success = success; } @@ -98958,7 +100125,7 @@ public void setFieldValue(_Fields field, Object value) { if (value == null) { unsetSuccess(); } else { - setSuccess((PrincipalPrivilegeSet)value); + setSuccess((List)value); } break; @@ -99004,12 +100171,12 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof get_privilege_set_result) - return this.equals((get_privilege_set_result)that); + if (that instanceof list_privileges_result) + return this.equals((list_privileges_result)that); return false; } - public boolean equals(get_privilege_set_result that) { + public boolean equals(list_privileges_result that) { if (that == null) return false; @@ -99051,13 +100218,13 @@ public int hashCode() { return builder.toHashCode(); } - public int compareTo(get_privilege_set_result other) { + public int compareTo(list_privileges_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - get_privilege_set_result typedOther = (get_privilege_set_result)other; + list_privileges_result typedOther = (list_privileges_result)other; lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); if (lastComparison != 0) { @@ -99096,7 +100263,7 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("get_privilege_set_result("); + StringBuilder sb = new StringBuilder("list_privileges_result("); boolean first = true; sb.append("success:"); @@ -99121,9 +100288,6 @@ public String toString() { public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity - if (success != null) { - success.validate(); - } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -99142,15 +100306,15 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class get_privilege_set_resultStandardSchemeFactory implements SchemeFactory { - public get_privilege_set_resultStandardScheme getScheme() { - return new get_privilege_set_resultStandardScheme(); + private static class list_privileges_resultStandardSchemeFactory implements SchemeFactory { + public list_privileges_resultStandardScheme getScheme() { + return new list_privileges_resultStandardScheme(); } } - private static class get_privilege_set_resultStandardScheme extends StandardScheme { + private static class list_privileges_resultStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, get_privilege_set_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -99161,9 +100325,19 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, get_privilege_set_r } switch (schemeField.id) { case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new PrincipalPrivilegeSet(); - struct.success.read(iprot); + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list700 = iprot.readListBegin(); + struct.success = new ArrayList(_list700.size); + for (int _i701 = 0; _i701 < _list700.size; ++_i701) + { + HiveObjectPrivilege _elem702; // required + _elem702 = new HiveObjectPrivilege(); + _elem702.read(iprot); + struct.success.add(_elem702); + } + iprot.readListEnd(); + } struct.setSuccessIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); @@ -99187,13 +100361,20 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, get_privilege_set_r struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, get_privilege_set_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, list_privileges_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (HiveObjectPrivilege _iter703 : struct.success) + { + _iter703.write(oprot); + } + oprot.writeListEnd(); + } oprot.writeFieldEnd(); } if (struct.o1 != null) { @@ -99207,16 +100388,16 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, get_privilege_set_ } - private static class get_privilege_set_resultTupleSchemeFactory implements SchemeFactory { - public get_privilege_set_resultTupleScheme getScheme() { - return new get_privilege_set_resultTupleScheme(); + private static class list_privileges_resultTupleSchemeFactory implements SchemeFactory { + public list_privileges_resultTupleScheme getScheme() { + return new list_privileges_resultTupleScheme(); } } - private static class get_privilege_set_resultTupleScheme extends TupleScheme { + private static class list_privileges_resultTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, get_privilege_set_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, list_privileges_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { @@ -99227,7 +100408,13 @@ public void write(org.apache.thrift.protocol.TProtocol prot, get_privilege_set_r } oprot.writeBitSet(optionals, 2); if (struct.isSetSuccess()) { - struct.success.write(oprot); + { + oprot.writeI32(struct.success.size()); + for (HiveObjectPrivilege _iter704 : struct.success) + { + _iter704.write(oprot); + } + } } if (struct.isSetO1()) { struct.o1.write(oprot); @@ -99235,12 +100422,21 @@ public void write(org.apache.thrift.protocol.TProtocol prot, get_privilege_set_r } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, get_privilege_set_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, list_privileges_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { - struct.success = new PrincipalPrivilegeSet(); - struct.success.read(iprot); + { + org.apache.thrift.protocol.TList _list705 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list705.size); + for (int _i706 = 0; _i706 < _list705.size; ++_i706) + { + HiveObjectPrivilege _elem707; // required + _elem707 = new HiveObjectPrivilege(); + _elem707.read(iprot); + struct.success.add(_elem707); + } + } struct.setSuccessIsSet(true); } if (incoming.get(1)) { @@ -99253,32 +100449,28 @@ public void read(org.apache.thrift.protocol.TProtocol prot, get_privilege_set_re } - public static class list_privileges_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_privileges_args"); + public static class list_privileges_for_auth_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_privileges_for_auth_args"); - private static final org.apache.thrift.protocol.TField PRINCIPAL_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("principal_name", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PRINCIPAL_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("principal_type", org.apache.thrift.protocol.TType.I32, (short)2); - private static final org.apache.thrift.protocol.TField HIVE_OBJECT_FIELD_DESC = new org.apache.thrift.protocol.TField("hiveObject", org.apache.thrift.protocol.TType.STRUCT, (short)3); + private static final org.apache.thrift.protocol.TField HIVE_OBJECT_FIELD_DESC = new org.apache.thrift.protocol.TField("hiveObject", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("user_name", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField GROUP_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("group_names", org.apache.thrift.protocol.TType.LIST, (short)3); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new list_privileges_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new list_privileges_argsTupleSchemeFactory()); + schemes.put(StandardScheme.class, new list_privileges_for_auth_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new list_privileges_for_auth_argsTupleSchemeFactory()); } - private String principal_name; // required - private PrincipalType principal_type; // required private HiveObjectRef hiveObject; // required + private String user_name; // required + private List group_names; // 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 { - PRINCIPAL_NAME((short)1, "principal_name"), - /** - * - * @see PrincipalType - */ - PRINCIPAL_TYPE((short)2, "principal_type"), - HIVE_OBJECT((short)3, "hiveObject"); + HIVE_OBJECT((short)1, "hiveObject"), + USER_NAME((short)2, "user_name"), + GROUP_NAMES((short)3, "group_names"); private static final Map byName = new HashMap(); @@ -99293,12 +100485,12 @@ public void read(org.apache.thrift.protocol.TProtocol prot, get_privilege_set_re */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case 1: // PRINCIPAL_NAME - return PRINCIPAL_NAME; - case 2: // PRINCIPAL_TYPE - return PRINCIPAL_TYPE; - case 3: // HIVE_OBJECT + case 1: // HIVE_OBJECT return HIVE_OBJECT; + case 2: // USER_NAME + return USER_NAME; + case 3: // GROUP_NAMES + return GROUP_NAMES; default: return null; } @@ -99342,156 +100534,168 @@ public String getFieldName() { 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.PRINCIPAL_NAME, new org.apache.thrift.meta_data.FieldMetaData("principal_name", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PRINCIPAL_TYPE, new org.apache.thrift.meta_data.FieldMetaData("principal_type", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PrincipalType.class))); tmpMap.put(_Fields.HIVE_OBJECT, new org.apache.thrift.meta_data.FieldMetaData("hiveObject", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HiveObjectRef.class))); + tmpMap.put(_Fields.USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("user_name", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.GROUP_NAMES, new org.apache.thrift.meta_data.FieldMetaData("group_names", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_privileges_args.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_privileges_for_auth_args.class, metaDataMap); } - public list_privileges_args() { + public list_privileges_for_auth_args() { } - public list_privileges_args( - String principal_name, - PrincipalType principal_type, - HiveObjectRef hiveObject) + public list_privileges_for_auth_args( + HiveObjectRef hiveObject, + String user_name, + List group_names) { this(); - this.principal_name = principal_name; - this.principal_type = principal_type; this.hiveObject = hiveObject; + this.user_name = user_name; + this.group_names = group_names; } /** * Performs a deep copy on other. */ - public list_privileges_args(list_privileges_args other) { - if (other.isSetPrincipal_name()) { - this.principal_name = other.principal_name; - } - if (other.isSetPrincipal_type()) { - this.principal_type = other.principal_type; - } + public list_privileges_for_auth_args(list_privileges_for_auth_args other) { if (other.isSetHiveObject()) { this.hiveObject = new HiveObjectRef(other.hiveObject); } + if (other.isSetUser_name()) { + this.user_name = other.user_name; + } + if (other.isSetGroup_names()) { + List __this__group_names = new ArrayList(); + for (String other_element : other.group_names) { + __this__group_names.add(other_element); + } + this.group_names = __this__group_names; + } } - public list_privileges_args deepCopy() { - return new list_privileges_args(this); + public list_privileges_for_auth_args deepCopy() { + return new list_privileges_for_auth_args(this); } @Override public void clear() { - this.principal_name = null; - this.principal_type = null; this.hiveObject = null; + this.user_name = null; + this.group_names = null; } - public String getPrincipal_name() { - return this.principal_name; + public HiveObjectRef getHiveObject() { + return this.hiveObject; } - public void setPrincipal_name(String principal_name) { - this.principal_name = principal_name; + public void setHiveObject(HiveObjectRef hiveObject) { + this.hiveObject = hiveObject; } - public void unsetPrincipal_name() { - this.principal_name = null; + public void unsetHiveObject() { + this.hiveObject = null; } - /** Returns true if field principal_name is set (has been assigned a value) and false otherwise */ - public boolean isSetPrincipal_name() { - return this.principal_name != null; + /** Returns true if field hiveObject is set (has been assigned a value) and false otherwise */ + public boolean isSetHiveObject() { + return this.hiveObject != null; } - public void setPrincipal_nameIsSet(boolean value) { + public void setHiveObjectIsSet(boolean value) { if (!value) { - this.principal_name = null; + this.hiveObject = null; } } - /** - * - * @see PrincipalType - */ - public PrincipalType getPrincipal_type() { - return this.principal_type; + public String getUser_name() { + return this.user_name; } - /** - * - * @see PrincipalType - */ - public void setPrincipal_type(PrincipalType principal_type) { - this.principal_type = principal_type; + public void setUser_name(String user_name) { + this.user_name = user_name; } - public void unsetPrincipal_type() { - this.principal_type = null; + public void unsetUser_name() { + this.user_name = null; } - /** Returns true if field principal_type is set (has been assigned a value) and false otherwise */ - public boolean isSetPrincipal_type() { - return this.principal_type != null; + /** Returns true if field user_name is set (has been assigned a value) and false otherwise */ + public boolean isSetUser_name() { + return this.user_name != null; } - public void setPrincipal_typeIsSet(boolean value) { + public void setUser_nameIsSet(boolean value) { if (!value) { - this.principal_type = null; + this.user_name = null; } } - public HiveObjectRef getHiveObject() { - return this.hiveObject; + public int getGroup_namesSize() { + return (this.group_names == null) ? 0 : this.group_names.size(); } - public void setHiveObject(HiveObjectRef hiveObject) { - this.hiveObject = hiveObject; + public java.util.Iterator getGroup_namesIterator() { + return (this.group_names == null) ? null : this.group_names.iterator(); } - public void unsetHiveObject() { - this.hiveObject = null; + public void addToGroup_names(String elem) { + if (this.group_names == null) { + this.group_names = new ArrayList(); + } + this.group_names.add(elem); } - /** Returns true if field hiveObject is set (has been assigned a value) and false otherwise */ - public boolean isSetHiveObject() { - return this.hiveObject != null; + public List getGroup_names() { + return this.group_names; } - public void setHiveObjectIsSet(boolean value) { + public void setGroup_names(List group_names) { + this.group_names = group_names; + } + + public void unsetGroup_names() { + this.group_names = null; + } + + /** Returns true if field group_names is set (has been assigned a value) and false otherwise */ + public boolean isSetGroup_names() { + return this.group_names != null; + } + + public void setGroup_namesIsSet(boolean value) { if (!value) { - this.hiveObject = null; + this.group_names = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { - case PRINCIPAL_NAME: + case HIVE_OBJECT: if (value == null) { - unsetPrincipal_name(); + unsetHiveObject(); } else { - setPrincipal_name((String)value); + setHiveObject((HiveObjectRef)value); } break; - case PRINCIPAL_TYPE: + case USER_NAME: if (value == null) { - unsetPrincipal_type(); + unsetUser_name(); } else { - setPrincipal_type((PrincipalType)value); + setUser_name((String)value); } break; - case HIVE_OBJECT: + case GROUP_NAMES: if (value == null) { - unsetHiveObject(); + unsetGroup_names(); } else { - setHiveObject((HiveObjectRef)value); + setGroup_names((List)value); } break; @@ -99500,15 +100704,15 @@ public void setFieldValue(_Fields field, Object value) { public Object getFieldValue(_Fields field) { switch (field) { - case PRINCIPAL_NAME: - return getPrincipal_name(); - - case PRINCIPAL_TYPE: - return getPrincipal_type(); - case HIVE_OBJECT: return getHiveObject(); + case USER_NAME: + return getUser_name(); + + case GROUP_NAMES: + return getGroup_names(); + } throw new IllegalStateException(); } @@ -99520,12 +100724,12 @@ public boolean isSet(_Fields field) { } switch (field) { - case PRINCIPAL_NAME: - return isSetPrincipal_name(); - case PRINCIPAL_TYPE: - return isSetPrincipal_type(); case HIVE_OBJECT: return isSetHiveObject(); + case USER_NAME: + return isSetUser_name(); + case GROUP_NAMES: + return isSetGroup_names(); } throw new IllegalStateException(); } @@ -99534,39 +100738,39 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof list_privileges_args) - return this.equals((list_privileges_args)that); + if (that instanceof list_privileges_for_auth_args) + return this.equals((list_privileges_for_auth_args)that); return false; } - public boolean equals(list_privileges_args that) { + public boolean equals(list_privileges_for_auth_args that) { if (that == null) return false; - boolean this_present_principal_name = true && this.isSetPrincipal_name(); - boolean that_present_principal_name = true && that.isSetPrincipal_name(); - if (this_present_principal_name || that_present_principal_name) { - if (!(this_present_principal_name && that_present_principal_name)) + boolean this_present_hiveObject = true && this.isSetHiveObject(); + boolean that_present_hiveObject = true && that.isSetHiveObject(); + if (this_present_hiveObject || that_present_hiveObject) { + if (!(this_present_hiveObject && that_present_hiveObject)) return false; - if (!this.principal_name.equals(that.principal_name)) + if (!this.hiveObject.equals(that.hiveObject)) return false; } - boolean this_present_principal_type = true && this.isSetPrincipal_type(); - boolean that_present_principal_type = true && that.isSetPrincipal_type(); - if (this_present_principal_type || that_present_principal_type) { - if (!(this_present_principal_type && that_present_principal_type)) + boolean this_present_user_name = true && this.isSetUser_name(); + boolean that_present_user_name = true && that.isSetUser_name(); + if (this_present_user_name || that_present_user_name) { + if (!(this_present_user_name && that_present_user_name)) return false; - if (!this.principal_type.equals(that.principal_type)) + if (!this.user_name.equals(that.user_name)) return false; } - boolean this_present_hiveObject = true && this.isSetHiveObject(); - boolean that_present_hiveObject = true && that.isSetHiveObject(); - if (this_present_hiveObject || that_present_hiveObject) { - if (!(this_present_hiveObject && that_present_hiveObject)) + boolean this_present_group_names = true && this.isSetGroup_names(); + boolean that_present_group_names = true && that.isSetGroup_names(); + if (this_present_group_names || that_present_group_names) { + if (!(this_present_group_names && that_present_group_names)) return false; - if (!this.hiveObject.equals(that.hiveObject)) + if (!this.group_names.equals(that.group_names)) return false; } @@ -99577,58 +100781,58 @@ public boolean equals(list_privileges_args that) { public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); - boolean present_principal_name = true && (isSetPrincipal_name()); - builder.append(present_principal_name); - if (present_principal_name) - builder.append(principal_name); - - boolean present_principal_type = true && (isSetPrincipal_type()); - builder.append(present_principal_type); - if (present_principal_type) - builder.append(principal_type.getValue()); - boolean present_hiveObject = true && (isSetHiveObject()); builder.append(present_hiveObject); if (present_hiveObject) builder.append(hiveObject); + boolean present_user_name = true && (isSetUser_name()); + builder.append(present_user_name); + if (present_user_name) + builder.append(user_name); + + boolean present_group_names = true && (isSetGroup_names()); + builder.append(present_group_names); + if (present_group_names) + builder.append(group_names); + return builder.toHashCode(); } - public int compareTo(list_privileges_args other) { + public int compareTo(list_privileges_for_auth_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - list_privileges_args typedOther = (list_privileges_args)other; + list_privileges_for_auth_args typedOther = (list_privileges_for_auth_args)other; - lastComparison = Boolean.valueOf(isSetPrincipal_name()).compareTo(typedOther.isSetPrincipal_name()); + lastComparison = Boolean.valueOf(isSetHiveObject()).compareTo(typedOther.isSetHiveObject()); if (lastComparison != 0) { return lastComparison; } - if (isSetPrincipal_name()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.principal_name, typedOther.principal_name); + if (isSetHiveObject()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hiveObject, typedOther.hiveObject); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetPrincipal_type()).compareTo(typedOther.isSetPrincipal_type()); + lastComparison = Boolean.valueOf(isSetUser_name()).compareTo(typedOther.isSetUser_name()); if (lastComparison != 0) { return lastComparison; } - if (isSetPrincipal_type()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.principal_type, typedOther.principal_type); + if (isSetUser_name()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user_name, typedOther.user_name); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetHiveObject()).compareTo(typedOther.isSetHiveObject()); + lastComparison = Boolean.valueOf(isSetGroup_names()).compareTo(typedOther.isSetGroup_names()); if (lastComparison != 0) { return lastComparison; } - if (isSetHiveObject()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hiveObject, typedOther.hiveObject); + if (isSetGroup_names()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.group_names, typedOther.group_names); if (lastComparison != 0) { return lastComparison; } @@ -99650,30 +100854,30 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("list_privileges_args("); + StringBuilder sb = new StringBuilder("list_privileges_for_auth_args("); boolean first = true; - sb.append("principal_name:"); - if (this.principal_name == null) { + sb.append("hiveObject:"); + if (this.hiveObject == null) { sb.append("null"); } else { - sb.append(this.principal_name); + sb.append(this.hiveObject); } first = false; if (!first) sb.append(", "); - sb.append("principal_type:"); - if (this.principal_type == null) { + sb.append("user_name:"); + if (this.user_name == null) { sb.append("null"); } else { - sb.append(this.principal_type); + sb.append(this.user_name); } first = false; if (!first) sb.append(", "); - sb.append("hiveObject:"); - if (this.hiveObject == null) { + sb.append("group_names:"); + if (this.group_names == null) { sb.append("null"); } else { - sb.append(this.hiveObject); + sb.append(this.group_names); } first = false; sb.append(")"); @@ -99704,15 +100908,15 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class list_privileges_argsStandardSchemeFactory implements SchemeFactory { - public list_privileges_argsStandardScheme getScheme() { - return new list_privileges_argsStandardScheme(); + private static class list_privileges_for_auth_argsStandardSchemeFactory implements SchemeFactory { + public list_privileges_for_auth_argsStandardScheme getScheme() { + return new list_privileges_for_auth_argsStandardScheme(); } } - private static class list_privileges_argsStandardScheme extends StandardScheme { + private static class list_privileges_for_auth_argsStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_for_auth_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -99722,27 +100926,37 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_arg break; } switch (schemeField.id) { - case 1: // PRINCIPAL_NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.principal_name = iprot.readString(); - struct.setPrincipal_nameIsSet(true); + case 1: // HIVE_OBJECT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.hiveObject = new HiveObjectRef(); + struct.hiveObject.read(iprot); + struct.setHiveObjectIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // PRINCIPAL_TYPE - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.principal_type = PrincipalType.findByValue(iprot.readI32()); - struct.setPrincipal_typeIsSet(true); + case 2: // USER_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.user_name = iprot.readString(); + struct.setUser_nameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 3: // HIVE_OBJECT - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.hiveObject = new HiveObjectRef(); - struct.hiveObject.read(iprot); - struct.setHiveObjectIsSet(true); + case 3: // GROUP_NAMES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list708 = iprot.readListBegin(); + struct.group_names = new ArrayList(_list708.size); + for (int _i709 = 0; _i709 < _list708.size; ++_i709) + { + String _elem710; // required + _elem710 = iprot.readString(); + struct.group_names.add(_elem710); + } + iprot.readListEnd(); + } + struct.setGroup_namesIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -99756,23 +100970,30 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_arg struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, list_privileges_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, list_privileges_for_auth_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); - if (struct.principal_name != null) { - oprot.writeFieldBegin(PRINCIPAL_NAME_FIELD_DESC); - oprot.writeString(struct.principal_name); + if (struct.hiveObject != null) { + oprot.writeFieldBegin(HIVE_OBJECT_FIELD_DESC); + struct.hiveObject.write(oprot); oprot.writeFieldEnd(); } - if (struct.principal_type != null) { - oprot.writeFieldBegin(PRINCIPAL_TYPE_FIELD_DESC); - oprot.writeI32(struct.principal_type.getValue()); + if (struct.user_name != null) { + oprot.writeFieldBegin(USER_NAME_FIELD_DESC); + oprot.writeString(struct.user_name); oprot.writeFieldEnd(); } - if (struct.hiveObject != null) { - oprot.writeFieldBegin(HIVE_OBJECT_FIELD_DESC); - struct.hiveObject.write(oprot); + if (struct.group_names != null) { + oprot.writeFieldBegin(GROUP_NAMES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.group_names.size())); + for (String _iter711 : struct.group_names) + { + oprot.writeString(_iter711); + } + oprot.writeListEnd(); + } oprot.writeFieldEnd(); } oprot.writeFieldStop(); @@ -99781,74 +101002,89 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, list_privileges_ar } - private static class list_privileges_argsTupleSchemeFactory implements SchemeFactory { - public list_privileges_argsTupleScheme getScheme() { - return new list_privileges_argsTupleScheme(); + private static class list_privileges_for_auth_argsTupleSchemeFactory implements SchemeFactory { + public list_privileges_for_auth_argsTupleScheme getScheme() { + return new list_privileges_for_auth_argsTupleScheme(); } } - private static class list_privileges_argsTupleScheme extends TupleScheme { + private static class list_privileges_for_auth_argsTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, list_privileges_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, list_privileges_for_auth_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); - if (struct.isSetPrincipal_name()) { + if (struct.isSetHiveObject()) { optionals.set(0); } - if (struct.isSetPrincipal_type()) { + if (struct.isSetUser_name()) { optionals.set(1); } - if (struct.isSetHiveObject()) { + if (struct.isSetGroup_names()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); - if (struct.isSetPrincipal_name()) { - oprot.writeString(struct.principal_name); - } - if (struct.isSetPrincipal_type()) { - oprot.writeI32(struct.principal_type.getValue()); - } if (struct.isSetHiveObject()) { struct.hiveObject.write(oprot); } + if (struct.isSetUser_name()) { + oprot.writeString(struct.user_name); + } + if (struct.isSetGroup_names()) { + { + oprot.writeI32(struct.group_names.size()); + for (String _iter712 : struct.group_names) + { + oprot.writeString(_iter712); + } + } + } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, list_privileges_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, list_privileges_for_auth_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { - struct.principal_name = iprot.readString(); - struct.setPrincipal_nameIsSet(true); + struct.hiveObject = new HiveObjectRef(); + struct.hiveObject.read(iprot); + struct.setHiveObjectIsSet(true); } if (incoming.get(1)) { - struct.principal_type = PrincipalType.findByValue(iprot.readI32()); - struct.setPrincipal_typeIsSet(true); + struct.user_name = iprot.readString(); + struct.setUser_nameIsSet(true); } if (incoming.get(2)) { - struct.hiveObject = new HiveObjectRef(); - struct.hiveObject.read(iprot); - struct.setHiveObjectIsSet(true); + { + org.apache.thrift.protocol.TList _list713 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.group_names = new ArrayList(_list713.size); + for (int _i714 = 0; _i714 < _list713.size; ++_i714) + { + String _elem715; // required + _elem715 = iprot.readString(); + struct.group_names.add(_elem715); + } + } + struct.setGroup_namesIsSet(true); } } } } - public static class list_privileges_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_privileges_result"); + public static class list_privileges_for_auth_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_privileges_for_auth_result"); private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); private static final org.apache.thrift.protocol.TField O1_FIELD_DESC = new org.apache.thrift.protocol.TField("o1", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new list_privileges_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new list_privileges_resultTupleSchemeFactory()); + schemes.put(StandardScheme.class, new list_privileges_for_auth_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new list_privileges_for_auth_resultTupleSchemeFactory()); } - private List success; // required + private List success; // required private MetaException o1; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -99918,18 +101154,18 @@ public String getFieldName() { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HiveObjectPrivilege.class)))); + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_privileges_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_privileges_for_auth_result.class, metaDataMap); } - public list_privileges_result() { + public list_privileges_for_auth_result() { } - public list_privileges_result( - List success, + public list_privileges_for_auth_result( + List success, MetaException o1) { this(); @@ -99940,11 +101176,11 @@ public list_privileges_result( /** * Performs a deep copy on other. */ - public list_privileges_result(list_privileges_result other) { + public list_privileges_for_auth_result(list_privileges_for_auth_result other) { if (other.isSetSuccess()) { - List __this__success = new ArrayList(); - for (HiveObjectPrivilege other_element : other.success) { - __this__success.add(new HiveObjectPrivilege(other_element)); + List __this__success = new ArrayList(); + for (String other_element : other.success) { + __this__success.add(other_element); } this.success = __this__success; } @@ -99953,8 +101189,8 @@ public list_privileges_result(list_privileges_result other) { } } - public list_privileges_result deepCopy() { - return new list_privileges_result(this); + public list_privileges_for_auth_result deepCopy() { + return new list_privileges_for_auth_result(this); } @Override @@ -99967,22 +101203,22 @@ public int getSuccessSize() { return (this.success == null) ? 0 : this.success.size(); } - public java.util.Iterator getSuccessIterator() { + public java.util.Iterator getSuccessIterator() { return (this.success == null) ? null : this.success.iterator(); } - public void addToSuccess(HiveObjectPrivilege elem) { + public void addToSuccess(String elem) { if (this.success == null) { - this.success = new ArrayList(); + this.success = new ArrayList(); } this.success.add(elem); } - public List getSuccess() { + public List getSuccess() { return this.success; } - public void setSuccess(List success) { + public void setSuccess(List success) { this.success = success; } @@ -100030,7 +101266,7 @@ public void setFieldValue(_Fields field, Object value) { if (value == null) { unsetSuccess(); } else { - setSuccess((List)value); + setSuccess((List)value); } break; @@ -100076,12 +101312,12 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof list_privileges_result) - return this.equals((list_privileges_result)that); + if (that instanceof list_privileges_for_auth_result) + return this.equals((list_privileges_for_auth_result)that); return false; } - public boolean equals(list_privileges_result that) { + public boolean equals(list_privileges_for_auth_result that) { if (that == null) return false; @@ -100123,13 +101359,13 @@ public int hashCode() { return builder.toHashCode(); } - public int compareTo(list_privileges_result other) { + public int compareTo(list_privileges_for_auth_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - list_privileges_result typedOther = (list_privileges_result)other; + list_privileges_for_auth_result typedOther = (list_privileges_for_auth_result)other; lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); if (lastComparison != 0) { @@ -100168,7 +101404,7 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("list_privileges_result("); + StringBuilder sb = new StringBuilder("list_privileges_for_auth_result("); boolean first = true; sb.append("success:"); @@ -100211,15 +101447,15 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class list_privileges_resultStandardSchemeFactory implements SchemeFactory { - public list_privileges_resultStandardScheme getScheme() { - return new list_privileges_resultStandardScheme(); + private static class list_privileges_for_auth_resultStandardSchemeFactory implements SchemeFactory { + public list_privileges_for_auth_resultStandardScheme getScheme() { + return new list_privileges_for_auth_resultStandardScheme(); } } - private static class list_privileges_resultStandardScheme extends StandardScheme { + private static class list_privileges_for_auth_resultStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_for_auth_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -100232,14 +101468,13 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_res case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list700 = iprot.readListBegin(); - struct.success = new ArrayList(_list700.size); - for (int _i701 = 0; _i701 < _list700.size; ++_i701) + org.apache.thrift.protocol.TList _list716 = iprot.readListBegin(); + struct.success = new ArrayList(_list716.size); + for (int _i717 = 0; _i717 < _list716.size; ++_i717) { - HiveObjectPrivilege _elem702; // required - _elem702 = new HiveObjectPrivilege(); - _elem702.read(iprot); - struct.success.add(_elem702); + String _elem718; // required + _elem718 = iprot.readString(); + struct.success.add(_elem718); } iprot.readListEnd(); } @@ -100266,17 +101501,17 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, list_privileges_res struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, list_privileges_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, list_privileges_for_auth_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (HiveObjectPrivilege _iter703 : struct.success) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); + for (String _iter719 : struct.success) { - _iter703.write(oprot); + oprot.writeString(_iter719); } oprot.writeListEnd(); } @@ -100293,16 +101528,16 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, list_privileges_re } - private static class list_privileges_resultTupleSchemeFactory implements SchemeFactory { - public list_privileges_resultTupleScheme getScheme() { - return new list_privileges_resultTupleScheme(); + private static class list_privileges_for_auth_resultTupleSchemeFactory implements SchemeFactory { + public list_privileges_for_auth_resultTupleScheme getScheme() { + return new list_privileges_for_auth_resultTupleScheme(); } } - private static class list_privileges_resultTupleScheme extends TupleScheme { + private static class list_privileges_for_auth_resultTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, list_privileges_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, list_privileges_for_auth_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { @@ -100315,9 +101550,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, list_privileges_res if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (HiveObjectPrivilege _iter704 : struct.success) + for (String _iter720 : struct.success) { - _iter704.write(oprot); + oprot.writeString(_iter720); } } } @@ -100327,19 +101562,18 @@ public void write(org.apache.thrift.protocol.TProtocol prot, list_privileges_res } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, list_privileges_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, list_privileges_for_auth_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list705 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list705.size); - for (int _i706 = 0; _i706 < _list705.size; ++_i706) + org.apache.thrift.protocol.TList _list721 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList(_list721.size); + for (int _i722 = 0; _i722 < _list721.size; ++_i722) { - HiveObjectPrivilege _elem707; // required - _elem707 = new HiveObjectPrivilege(); - _elem707.read(iprot); - struct.success.add(_elem707); + String _elem723; // required + _elem723 = iprot.readString(); + struct.success.add(_elem723); } } struct.setSuccessIsSet(true); @@ -102412,13 +103646,13 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, set_ugi_args struct case 2: // GROUP_NAMES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list708 = iprot.readListBegin(); - struct.group_names = new ArrayList(_list708.size); - for (int _i709 = 0; _i709 < _list708.size; ++_i709) + org.apache.thrift.protocol.TList _list724 = iprot.readListBegin(); + struct.group_names = new ArrayList(_list724.size); + for (int _i725 = 0; _i725 < _list724.size; ++_i725) { - String _elem710; // required - _elem710 = iprot.readString(); - struct.group_names.add(_elem710); + String _elem726; // required + _elem726 = iprot.readString(); + struct.group_names.add(_elem726); } iprot.readListEnd(); } @@ -102449,9 +103683,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, set_ugi_args struc oprot.writeFieldBegin(GROUP_NAMES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.group_names.size())); - for (String _iter711 : struct.group_names) + for (String _iter727 : struct.group_names) { - oprot.writeString(_iter711); + oprot.writeString(_iter727); } oprot.writeListEnd(); } @@ -102488,9 +103722,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, set_ugi_args struct if (struct.isSetGroup_names()) { { oprot.writeI32(struct.group_names.size()); - for (String _iter712 : struct.group_names) + for (String _iter728 : struct.group_names) { - oprot.writeString(_iter712); + oprot.writeString(_iter728); } } } @@ -102506,13 +103740,13 @@ public void read(org.apache.thrift.protocol.TProtocol prot, set_ugi_args struct) } if (incoming.get(1)) { { - org.apache.thrift.protocol.TList _list713 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.group_names = new ArrayList(_list713.size); - for (int _i714 = 0; _i714 < _list713.size; ++_i714) + org.apache.thrift.protocol.TList _list729 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.group_names = new ArrayList(_list729.size); + for (int _i730 = 0; _i730 < _list729.size; ++_i730) { - String _elem715; // required - _elem715 = iprot.readString(); - struct.group_names.add(_elem715); + String _elem731; // required + _elem731 = iprot.readString(); + struct.group_names.add(_elem731); } } struct.setGroup_namesIsSet(true); @@ -102918,13 +104152,13 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, set_ugi_result stru case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list716 = iprot.readListBegin(); - struct.success = new ArrayList(_list716.size); - for (int _i717 = 0; _i717 < _list716.size; ++_i717) + org.apache.thrift.protocol.TList _list732 = iprot.readListBegin(); + struct.success = new ArrayList(_list732.size); + for (int _i733 = 0; _i733 < _list732.size; ++_i733) { - String _elem718; // required - _elem718 = iprot.readString(); - struct.success.add(_elem718); + String _elem734; // required + _elem734 = iprot.readString(); + struct.success.add(_elem734); } iprot.readListEnd(); } @@ -102959,9 +104193,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, set_ugi_result str oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter719 : struct.success) + for (String _iter735 : struct.success) { - oprot.writeString(_iter719); + oprot.writeString(_iter735); } oprot.writeListEnd(); } @@ -103000,9 +104234,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, set_ugi_result stru if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter720 : struct.success) + for (String _iter736 : struct.success) { - oprot.writeString(_iter720); + oprot.writeString(_iter736); } } } @@ -103017,13 +104251,13 @@ public void read(org.apache.thrift.protocol.TProtocol prot, set_ugi_result struc BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list721 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList(_list721.size); - for (int _i722 = 0; _i722 < _list721.size; ++_i722) + org.apache.thrift.protocol.TList _list737 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList(_list737.size); + for (int _i738 = 0; _i738 < _list737.size; ++_i738) { - String _elem723; // required - _elem723 = iprot.readString(); - struct.success.add(_elem723); + String _elem739; // required + _elem739 = iprot.readString(); + struct.success.add(_elem739); } } struct.setSuccessIsSet(true); diff --git metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php index 58d910a..b07e87b 100644 --- metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php +++ metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php @@ -96,6 +96,7 @@ interface ThriftHiveMetastoreIf extends \FacebookServiceIf { public function list_roles($principal_name, $principal_type); public function get_privilege_set(\metastore\HiveObjectRef $hiveObject, $user_name, $group_names); public function list_privileges($principal_name, $principal_type, \metastore\HiveObjectRef $hiveObject); + public function list_privileges_for_auth(\metastore\HiveObjectRef $hiveObject, $user_name, $group_names); public function grant_privileges(\metastore\PrivilegeBag $privileges); public function revoke_privileges(\metastore\PrivilegeBag $privileges); public function set_ugi($user_name, $group_names); @@ -4826,6 +4827,62 @@ class ThriftHiveMetastoreClient extends \FacebookServiceClient implements \metas throw new \Exception("list_privileges failed: unknown result"); } + public function list_privileges_for_auth(\metastore\HiveObjectRef $hiveObject, $user_name, $group_names) + { + $this->send_list_privileges_for_auth($hiveObject, $user_name, $group_names); + return $this->recv_list_privileges_for_auth(); + } + + public function send_list_privileges_for_auth(\metastore\HiveObjectRef $hiveObject, $user_name, $group_names) + { + $args = new \metastore\ThriftHiveMetastore_list_privileges_for_auth_args(); + $args->hiveObject = $hiveObject; + $args->user_name = $user_name; + $args->group_names = $group_names; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'list_privileges_for_auth', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('list_privileges_for_auth', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_list_privileges_for_auth() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\metastore\ThriftHiveMetastore_list_privileges_for_auth_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_list_privileges_for_auth_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + if ($result->o1 !== null) { + throw $result->o1; + } + throw new \Exception("list_privileges_for_auth failed: unknown result"); + } + public function grant_privileges(\metastore\PrivilegeBag $privileges) { $this->send_grant_privileges($privileges); @@ -24596,6 +24653,269 @@ class ThriftHiveMetastore_list_privileges_result { } +class ThriftHiveMetastore_list_privileges_for_auth_args { + static $_TSPEC; + + public $hiveObject = null; + public $user_name = null; + public $group_names = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'hiveObject', + 'type' => TType::STRUCT, + 'class' => '\metastore\HiveObjectRef', + ), + 2 => array( + 'var' => 'user_name', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'group_names', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + ); + } + if (is_array($vals)) { + if (isset($vals['hiveObject'])) { + $this->hiveObject = $vals['hiveObject']; + } + if (isset($vals['user_name'])) { + $this->user_name = $vals['user_name']; + } + if (isset($vals['group_names'])) { + $this->group_names = $vals['group_names']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_list_privileges_for_auth_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::STRUCT) { + $this->hiveObject = new \metastore\HiveObjectRef(); + $xfer += $this->hiveObject->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->user_name); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::LST) { + $this->group_names = array(); + $_size624 = 0; + $_etype627 = 0; + $xfer += $input->readListBegin($_etype627, $_size624); + for ($_i628 = 0; $_i628 < $_size624; ++$_i628) + { + $elem629 = null; + $xfer += $input->readString($elem629); + $this->group_names []= $elem629; + } + $xfer += $input->readListEnd(); + } 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_list_privileges_for_auth_args'); + if ($this->hiveObject !== null) { + if (!is_object($this->hiveObject)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('hiveObject', TType::STRUCT, 1); + $xfer += $this->hiveObject->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->user_name !== null) { + $xfer += $output->writeFieldBegin('user_name', TType::STRING, 2); + $xfer += $output->writeString($this->user_name); + $xfer += $output->writeFieldEnd(); + } + if ($this->group_names !== null) { + if (!is_array($this->group_names)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('group_names', TType::LST, 3); + { + $output->writeListBegin(TType::STRING, count($this->group_names)); + { + foreach ($this->group_names as $iter630) + { + $xfer += $output->writeString($iter630); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftHiveMetastore_list_privileges_for_auth_result { + static $_TSPEC; + + public $success = null; + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => '\metastore\MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_list_privileges_for_auth_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 0: + if ($ftype == TType::LST) { + $this->success = array(); + $_size631 = 0; + $_etype634 = 0; + $xfer += $input->readListBegin($_etype634, $_size631); + for ($_i635 = 0; $_i635 < $_size631; ++$_i635) + { + $elem636 = null; + $xfer += $input->readString($elem636); + $this->success []= $elem636; + } + $xfer += $input->readListEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new \metastore\MetaException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_list_privileges_for_auth_result'); + if ($this->success !== null) { + if (!is_array($this->success)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('success', TType::LST, 0); + { + $output->writeListBegin(TType::STRING, count($this->success)); + { + foreach ($this->success as $iter637) + { + $xfer += $output->writeString($iter637); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + if ($this->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class ThriftHiveMetastore_grant_privileges_args { static $_TSPEC; @@ -25000,14 +25320,14 @@ class ThriftHiveMetastore_set_ugi_args { case 2: if ($ftype == TType::LST) { $this->group_names = array(); - $_size624 = 0; - $_etype627 = 0; - $xfer += $input->readListBegin($_etype627, $_size624); - for ($_i628 = 0; $_i628 < $_size624; ++$_i628) + $_size638 = 0; + $_etype641 = 0; + $xfer += $input->readListBegin($_etype641, $_size638); + for ($_i642 = 0; $_i642 < $_size638; ++$_i642) { - $elem629 = null; - $xfer += $input->readString($elem629); - $this->group_names []= $elem629; + $elem643 = null; + $xfer += $input->readString($elem643); + $this->group_names []= $elem643; } $xfer += $input->readListEnd(); } else { @@ -25040,9 +25360,9 @@ class ThriftHiveMetastore_set_ugi_args { { $output->writeListBegin(TType::STRING, count($this->group_names)); { - foreach ($this->group_names as $iter630) + foreach ($this->group_names as $iter644) { - $xfer += $output->writeString($iter630); + $xfer += $output->writeString($iter644); } } $output->writeListEnd(); @@ -25112,14 +25432,14 @@ class ThriftHiveMetastore_set_ugi_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size631 = 0; - $_etype634 = 0; - $xfer += $input->readListBegin($_etype634, $_size631); - for ($_i635 = 0; $_i635 < $_size631; ++$_i635) + $_size645 = 0; + $_etype648 = 0; + $xfer += $input->readListBegin($_etype648, $_size645); + for ($_i649 = 0; $_i649 < $_size645; ++$_i649) { - $elem636 = null; - $xfer += $input->readString($elem636); - $this->success []= $elem636; + $elem650 = null; + $xfer += $input->readString($elem650); + $this->success []= $elem650; } $xfer += $input->readListEnd(); } else { @@ -25155,9 +25475,9 @@ class ThriftHiveMetastore_set_ugi_result { { $output->writeListBegin(TType::STRING, count($this->success)); { - foreach ($this->success as $iter637) + foreach ($this->success as $iter651) { - $xfer += $output->writeString($iter637); + $xfer += $output->writeString($iter651); } } $output->writeListEnd(); diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote old mode 100644 new mode 100755 index 9e002d0..100d52d --- metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote +++ metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote @@ -103,6 +103,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' list_roles(string principal_name, PrincipalType principal_type)' print ' PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, string user_name, group_names)' print ' list_privileges(string principal_name, PrincipalType principal_type, HiveObjectRef hiveObject)' + print ' list_privileges_for_auth(HiveObjectRef hiveObject, string user_name, group_names)' print ' bool grant_privileges(PrivilegeBag privileges)' print ' bool revoke_privileges(PrivilegeBag privileges)' print ' set_ugi(string user_name, group_names)' @@ -640,6 +641,12 @@ elif cmd == 'list_privileges': sys.exit(1) pp.pprint(client.list_privileges(args[0],eval(args[1]),eval(args[2]),)) +elif cmd == 'list_privileges_for_auth': + if len(args) != 3: + print 'list_privileges_for_auth requires 3 args' + sys.exit(1) + pp.pprint(client.list_privileges_for_auth(eval(args[0]),args[1],eval(args[2]),)) + elif cmd == 'grant_privileges': if len(args) != 1: print 'grant_privileges requires 1 args' diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py index dfffdf5..3395912 100644 --- metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py +++ metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py @@ -709,6 +709,15 @@ def list_privileges(self, principal_name, principal_type, hiveObject): """ pass + def list_privileges_for_auth(self, hiveObject, user_name, group_names): + """ + Parameters: + - hiveObject + - user_name + - group_names + """ + pass + def grant_privileges(self, privileges): """ Parameters: @@ -3757,6 +3766,42 @@ def recv_list_privileges(self, ): raise result.o1 raise TApplicationException(TApplicationException.MISSING_RESULT, "list_privileges failed: unknown result"); + def list_privileges_for_auth(self, hiveObject, user_name, group_names): + """ + Parameters: + - hiveObject + - user_name + - group_names + """ + self.send_list_privileges_for_auth(hiveObject, user_name, group_names) + return self.recv_list_privileges_for_auth() + + def send_list_privileges_for_auth(self, hiveObject, user_name, group_names): + self._oprot.writeMessageBegin('list_privileges_for_auth', TMessageType.CALL, self._seqid) + args = list_privileges_for_auth_args() + args.hiveObject = hiveObject + args.user_name = user_name + args.group_names = group_names + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_list_privileges_for_auth(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = list_privileges_for_auth_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.o1 is not None: + raise result.o1 + raise TApplicationException(TApplicationException.MISSING_RESULT, "list_privileges_for_auth failed: unknown result"); + def grant_privileges(self, privileges): """ Parameters: @@ -4035,6 +4080,7 @@ def __init__(self, handler): self._processMap["list_roles"] = Processor.process_list_roles self._processMap["get_privilege_set"] = Processor.process_get_privilege_set self._processMap["list_privileges"] = Processor.process_list_privileges + self._processMap["list_privileges_for_auth"] = Processor.process_list_privileges_for_auth self._processMap["grant_privileges"] = Processor.process_grant_privileges self._processMap["revoke_privileges"] = Processor.process_revoke_privileges self._processMap["set_ugi"] = Processor.process_set_ugi @@ -5383,6 +5429,20 @@ def process_list_privileges(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_list_privileges_for_auth(self, seqid, iprot, oprot): + args = list_privileges_for_auth_args() + args.read(iprot) + iprot.readMessageEnd() + result = list_privileges_for_auth_result() + try: + result.success = self._handler.list_privileges_for_auth(args.hiveObject, args.user_name, args.group_names) + except MetaException as o1: + result.o1 = o1 + oprot.writeMessageBegin("list_privileges_for_auth", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_grant_privileges(self, seqid, iprot, oprot): args = grant_privileges_args() args.read(iprot) @@ -19236,6 +19296,179 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +class list_privileges_for_auth_args: + """ + Attributes: + - hiveObject + - user_name + - group_names + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'hiveObject', (HiveObjectRef, HiveObjectRef.thrift_spec), None, ), # 1 + (2, TType.STRING, 'user_name', None, None, ), # 2 + (3, TType.LIST, 'group_names', (TType.STRING,None), None, ), # 3 + ) + + def __init__(self, hiveObject=None, user_name=None, group_names=None,): + self.hiveObject = hiveObject + self.user_name = user_name + self.group_names = group_names + + 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.hiveObject = HiveObjectRef() + self.hiveObject.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.user_name = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.LIST: + self.group_names = [] + (_etype627, _size624) = iprot.readListBegin() + for _i628 in xrange(_size624): + _elem629 = iprot.readString(); + self.group_names.append(_elem629) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('list_privileges_for_auth_args') + if self.hiveObject is not None: + oprot.writeFieldBegin('hiveObject', TType.STRUCT, 1) + self.hiveObject.write(oprot) + oprot.writeFieldEnd() + if self.user_name is not None: + oprot.writeFieldBegin('user_name', TType.STRING, 2) + oprot.writeString(self.user_name) + oprot.writeFieldEnd() + if self.group_names is not None: + oprot.writeFieldBegin('group_names', TType.LIST, 3) + oprot.writeListBegin(TType.STRING, len(self.group_names)) + for iter630 in self.group_names: + oprot.writeString(iter630) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class list_privileges_for_auth_result: + """ + Attributes: + - success + - o1 + """ + + thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRING,None), None, ), # 0 + (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1 + ) + + def __init__(self, success=None, o1=None,): + self.success = success + self.o1 = o1 + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype634, _size631) = iprot.readListBegin() + for _i635 in xrange(_size631): + _elem636 = iprot.readString(); + self.success.append(_elem636) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.o1 = MetaException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('list_privileges_for_auth_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRING, len(self.success)) + for iter637 in self.success: + oprot.writeString(iter637) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.o1 is not None: + oprot.writeFieldBegin('o1', TType.STRUCT, 1) + self.o1.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class grant_privileges_args: """ Attributes: @@ -19536,10 +19769,10 @@ def read(self, iprot): elif fid == 2: if ftype == TType.LIST: self.group_names = [] - (_etype627, _size624) = iprot.readListBegin() - for _i628 in xrange(_size624): - _elem629 = iprot.readString(); - self.group_names.append(_elem629) + (_etype641, _size638) = iprot.readListBegin() + for _i642 in xrange(_size638): + _elem643 = iprot.readString(); + self.group_names.append(_elem643) iprot.readListEnd() else: iprot.skip(ftype) @@ -19560,8 +19793,8 @@ def write(self, oprot): if self.group_names is not None: oprot.writeFieldBegin('group_names', TType.LIST, 2) oprot.writeListBegin(TType.STRING, len(self.group_names)) - for iter630 in self.group_names: - oprot.writeString(iter630) + for iter644 in self.group_names: + oprot.writeString(iter644) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -19610,10 +19843,10 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype634, _size631) = iprot.readListBegin() - for _i635 in xrange(_size631): - _elem636 = iprot.readString(); - self.success.append(_elem636) + (_etype648, _size645) = iprot.readListBegin() + for _i649 in xrange(_size645): + _elem650 = iprot.readString(); + self.success.append(_elem650) iprot.readListEnd() else: iprot.skip(ftype) @@ -19636,8 +19869,8 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRING, len(self.success)) - for iter637 in self.success: - oprot.writeString(iter637) + for iter651 in self.success: + oprot.writeString(iter651) oprot.writeListEnd() oprot.writeFieldEnd() if self.o1 is not None: diff --git metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb index ac9826d..67017c3 100644 --- metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb +++ metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb @@ -1380,6 +1380,22 @@ module ThriftHiveMetastore raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'list_privileges failed: unknown result') end + def list_privileges_for_auth(hiveObject, user_name, group_names) + send_list_privileges_for_auth(hiveObject, user_name, group_names) + return recv_list_privileges_for_auth() + end + + def send_list_privileges_for_auth(hiveObject, user_name, group_names) + send_message('list_privileges_for_auth', List_privileges_for_auth_args, :hiveObject => hiveObject, :user_name => user_name, :group_names => group_names) + end + + def recv_list_privileges_for_auth() + result = receive_message(List_privileges_for_auth_result) + return result.success unless result.success.nil? + raise result.o1 unless result.o1.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'list_privileges_for_auth failed: unknown result') + end + def grant_privileges(privileges) send_grant_privileges(privileges) return recv_grant_privileges() @@ -2566,6 +2582,17 @@ module ThriftHiveMetastore write_result(result, oprot, 'list_privileges', seqid) end + def process_list_privileges_for_auth(seqid, iprot, oprot) + args = read_args(iprot, List_privileges_for_auth_args) + result = List_privileges_for_auth_result.new() + begin + result.success = @handler.list_privileges_for_auth(args.hiveObject, args.user_name, args.group_names) + rescue ::MetaException => o1 + result.o1 = o1 + end + write_result(result, oprot, 'list_privileges_for_auth', seqid) + end + def process_grant_privileges(seqid, iprot, oprot) args = read_args(iprot, Grant_privileges_args) result = Grant_privileges_result.new() @@ -5821,6 +5848,44 @@ module ThriftHiveMetastore ::Thrift::Struct.generate_accessors self end + class List_privileges_for_auth_args + include ::Thrift::Struct, ::Thrift::Struct_Union + HIVEOBJECT = 1 + USER_NAME = 2 + GROUP_NAMES = 3 + + FIELDS = { + HIVEOBJECT => {:type => ::Thrift::Types::STRUCT, :name => 'hiveObject', :class => ::HiveObjectRef}, + USER_NAME => {:type => ::Thrift::Types::STRING, :name => 'user_name'}, + GROUP_NAMES => {:type => ::Thrift::Types::LIST, :name => 'group_names', :element => {:type => ::Thrift::Types::STRING}} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class List_privileges_for_auth_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + O1 = 1 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}}, + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + class Grant_privileges_args include ::Thrift::Struct, ::Thrift::Struct_Union PRIVILEGES = 1 diff --git metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index 4905be0..29ed84d 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -42,7 +42,6 @@ import java.util.Properties; import java.util.Set; import java.util.Timer; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Pattern; import org.apache.commons.cli.OptionBuilder; @@ -3627,6 +3626,46 @@ public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, return null; } + public List list_privileges_for_auth(HiveObjectRef hiveObject, + String userName, List groupNames) throws MetaException, TException { + incrementCounter("list_privileges_for_auth"); + try { + String[] name = toStringName(hiveObject); + HiveObjectType type = hiveObject.getObjectType(); + return getMS().getPrivilegesForAuth(name, type, userName, groupNames); + } catch (MetaException e) { + throw e; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private String[] toStringName(HiveObjectRef hiveObject) throws MetaException { + switch (hiveObject.getObjectType()) { + case GLOBAL: + return null; + case DATABASE: + return new String[] { hiveObject.getDbName().toLowerCase()}; + case TABLE: + return new String[] { + hiveObject.getDbName().toLowerCase(), + hiveObject.getObjectName().toLowerCase()}; + case PARTITION: + return new String[] { + hiveObject.getDbName().toLowerCase(), + hiveObject.getObjectName().toLowerCase(), + getPartName(hiveObject) + }; + case COLUMN: + return new String[] { + hiveObject.getDbName().toLowerCase(), + hiveObject.getObjectName().toLowerCase(), + getPartName(hiveObject), hiveObject.getColumnName() + }; + } + throw new IllegalArgumentException(hiveObject.toString()); + } + private String getPartName(HiveObjectRef hiveObject) throws MetaException { String partName = null; List partValue = hiveObject.getPartValues(); diff --git metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index bcbb52e..84cc004 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -1372,6 +1372,12 @@ public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, return client.list_privileges(principalName, principalType, hiveObject); } + @Override + public List list_privileges_for_auth(HiveObjectRef hiveObject, + String user_name, List group_names) throws MetaException, TException { + return client.list_privileges_for_auth(hiveObject, user_name, group_names); + } + public String getDelegationToken(String renewerKerberosPrincipalName) throws MetaException, TException, IOException { //a convenience method that makes the intended owner for the delegation diff --git metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index 7af4368..e1d7f3e 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -957,6 +957,18 @@ public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, throws MetaException, TException; /** + * @param hiveObject + * @param user_name + * @param group_names + * @return + * @throws MetaException + * @throws TException + */ + public List list_privileges_for_auth(HiveObjectRef hiveObject, + String user_name, List group_names) + throws MetaException, TException; + + /** * @param privileges * @return true on success * @throws MetaException diff --git metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java index 0715e22..f32bea2 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -48,7 +49,6 @@ import javax.jdo.datastore.DataStoreCache; import javax.jdo.identity.IntIdentity; -import org.antlr.runtime.CharStream; import org.antlr.runtime.CommonTokenStream; import org.antlr.runtime.RecognitionException; import org.apache.commons.logging.Log; @@ -110,6 +110,7 @@ import org.apache.hadoop.hive.metastore.model.MPartitionColumnStatistics; import org.apache.hadoop.hive.metastore.model.MPartitionEvent; import org.apache.hadoop.hive.metastore.model.MPartitionPrivilege; +import org.apache.hadoop.hive.metastore.model.MPrincipalDesc; import org.apache.hadoop.hive.metastore.model.MRole; import org.apache.hadoop.hive.metastore.model.MRoleMap; import org.apache.hadoop.hive.metastore.model.MSerDeInfo; @@ -265,8 +266,7 @@ private static PartitionExpressionProxy createExpressionProxy(Configuration conf @SuppressWarnings("unchecked") Class clazz = (Class)MetaStoreUtils.getClass(className); - return (PartitionExpressionProxy)MetaStoreUtils.newInstance( - clazz, new Class[0], new Object[0]); + return MetaStoreUtils.newInstance(clazz, new Class[0], new Object[0]); } catch (MetaException e) { LOG.error("Error loading PartitionExpressionProxy", e); throw new RuntimeException("Error loading PartitionExpressionProxy: " + e.getMessage()); @@ -3136,6 +3136,17 @@ private MRole getMRole(String roleName) { } } + public List getUserPrivileges(String principalName, PrincipalType principalType) + throws InvalidObjectException, MetaException { + List grantInfos = new ArrayList(); + for (MGlobalPrivilege privilege : listPrincipalGlobalGrants(principalName, principalType)) { + grantInfos.add(new PrivilegeGrantInfo(privilege.getPrivilege(), privilege + .getCreateTime(), privilege.getGrantor(), getPrincipalTypeFromStr(privilege + .getGrantorType()), privilege.getGrantOption())); + } + return grantInfos; + } + @Override public PrincipalPrivilegeSet getUserPrivilegeSet(String userName, List groupNames) throws InvalidObjectException, MetaException { @@ -3355,14 +3366,14 @@ public PrincipalPrivilegeSet getColumnPrivilegeSet(String dbName, if (userName != null) { Map> columnUserPriv = new HashMap>(); columnUserPriv.put(userName, getColumnPrivilege(dbName, tableName, - columnName, partitionName, userName, PrincipalType.USER)); + partitionName, columnName, userName, PrincipalType.USER)); ret.setUserPrivileges(columnUserPriv); } if (groupNames != null && groupNames.size() > 0) { Map> columnGroupPriv = new HashMap>(); for (String groupName : groupNames) { columnGroupPriv.put(groupName, getColumnPrivilege(dbName, tableName, - columnName, partitionName, groupName, PrincipalType.GROUP)); + partitionName, columnName, groupName, PrincipalType.GROUP)); } ret.setGroupPrivileges(columnGroupPriv); } @@ -3372,7 +3383,7 @@ public PrincipalPrivilegeSet getColumnPrivilegeSet(String dbName, for (MRoleMap role : roles) { String roleName = role.getRole().getRoleName(); columnRolePriv.put(roleName, getColumnPrivilege(dbName, tableName, - columnName, partitionName, roleName, PrincipalType.ROLE)); + partitionName, columnName, roleName, PrincipalType.ROLE)); } ret.setRolePrivileges(columnRolePriv); } @@ -3385,6 +3396,71 @@ public PrincipalPrivilegeSet getColumnPrivilegeSet(String dbName, return ret; } + private Set listPrincipals(String userName, List groupNames) { + Set visited = new LinkedHashSet(); + if (userName != null) { + visited.add(new MPrincipalDesc(userName, PrincipalType.USER.name())); + iterateRoles(listRoles(userName, PrincipalType.USER), visited); + } + if (groupNames != null) { + for (String groupName : groupNames) { + visited.add(new MPrincipalDesc(groupName, PrincipalType.GROUP.name())); + iterateRoles(listRoles(groupName, PrincipalType.GROUP), visited); + } + } + return visited; + } + + private Set iterateRoles(List roles, Set visited) { + for (MRoleMap roleMap : roles) { + MRole role = roleMap.getRole(); + if (visited.add(new MPrincipalDesc(role.getRoleName(), PrincipalType.ROLE.name()))) { + iterateRoles(listRoles(role.getRoleName(), PrincipalType.ROLE), visited); + } + } + return visited; + } + + @Override + public List getPrivilegesForAuth(String[] name, HiveObjectType type, + String userName, List groupNames) throws InvalidObjectException, MetaException { + boolean commited = false; + Set result = new HashSet(); + try { + openTransaction(); + for (MPrincipalDesc principal : listPrincipals(userName, groupNames)) { + for (PrivilegeGrantInfo grant : getPrivileges(name, type, principal)) { + result.add(grant.getPrivilege().toLowerCase()); + } + } + commited = commitTransaction(); + } finally { + if (!commited) { + rollbackTransaction(); + } + } + return new ArrayList(result); + } + + private List getPrivileges(String[] name, HiveObjectType type, + MPrincipalDesc principal) throws InvalidObjectException, MetaException { + String pname = principal.getName(); + PrincipalType ptype = PrincipalType.valueOf(principal.getType()); + switch (type) { + case GLOBAL: + return getUserPrivileges(pname, ptype); + case DATABASE: + return getDBPrivilege(name[0], pname, ptype); + case TABLE: + return getTablePrivilege(name[0], name[1], pname, ptype); + case PARTITION: + return getPartitionPrivilege(name[0], name[1], name[2], pname, ptype); + case COLUMN: + return getColumnPrivilege(name[0], name[1], name[2], name[3], pname, ptype); + } + throw new IllegalArgumentException("invalid type " + type); + } + private List getPartitionPrivilege(String dbName, String tableName, String partName, String principalName, PrincipalType principalType) { @@ -3441,7 +3517,7 @@ private PrincipalType getPrincipalTypeFromStr(String str) { } private List getColumnPrivilege(String dbName, - String tableName, String columnName, String partitionName, + String tableName, String partitionName, String columnName, String principalName, PrincipalType principalType) { tableName = tableName.toLowerCase().trim(); diff --git metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java index 2e3b6da..f07876d 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java @@ -30,6 +30,7 @@ import org.apache.hadoop.hive.metastore.api.ColumnStatistics; import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege; +import org.apache.hadoop.hive.metastore.api.HiveObjectType; import org.apache.hadoop.hive.metastore.api.Index; import org.apache.hadoop.hive.metastore.api.InvalidInputException; import org.apache.hadoop.hive.metastore.api.InvalidObjectException; @@ -248,6 +249,9 @@ public abstract PrincipalPrivilegeSet getPartitionPrivilegeSet (String dbName, S public abstract PrincipalPrivilegeSet getColumnPrivilegeSet (String dbName, String tableName, String partitionName, String columnName, String userName, List groupNames) throws InvalidObjectException, MetaException; + public abstract List getPrivilegesForAuth(String[] name, HiveObjectType type, + String userName, List groupNames) throws InvalidObjectException, MetaException; + public abstract List listPrincipalGlobalGrants(String principalName, PrincipalType principalType); diff --git metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java index 6998b43..42ef380 100644 --- metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java +++ metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java @@ -28,6 +28,7 @@ import org.apache.hadoop.hive.metastore.api.ColumnStatistics; import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege; +import org.apache.hadoop.hive.metastore.api.HiveObjectType; import org.apache.hadoop.hive.metastore.api.Index; import org.apache.hadoop.hive.metastore.api.InvalidInputException; import org.apache.hadoop.hive.metastore.api.InvalidObjectException; @@ -390,6 +391,12 @@ public PrincipalPrivilegeSet getColumnPrivilegeSet(String dbName, String tableNa } @Override + public List getPrivilegesForAuth(String[] name, HiveObjectType type, + String userName, List groupNames) throws InvalidObjectException, MetaException { + return objectStore.getPrivilegesForAuth(name, type, userName, groupNames); + } + + @Override public List listPrincipalGlobalGrants(String principalName, PrincipalType principalType) { return objectStore.listPrincipalGlobalGrants(principalName, principalType); diff --git metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java index f54ae53..adbc5a0 100644 --- metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java +++ metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hive.metastore.api.ColumnStatistics; import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege; +import org.apache.hadoop.hive.metastore.api.HiveObjectType; import org.apache.hadoop.hive.metastore.api.Index; import org.apache.hadoop.hive.metastore.api.InvalidInputException; import org.apache.hadoop.hive.metastore.api.InvalidObjectException; @@ -412,6 +413,12 @@ public PrincipalPrivilegeSet getColumnPrivilegeSet(String dbName, String tableNa } @Override + public List getPrivilegesForAuth(String[] name, HiveObjectType type, + String userName, List groupNames) throws InvalidObjectException, MetaException { + return null; + } + + @Override public List listPrincipalGlobalGrants(String principalName, PrincipalType principalType) { diff --git ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java index e59decc..14134cc 100644 --- ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java +++ ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java @@ -2044,6 +2044,19 @@ public PrincipalPrivilegeSet get_privilege_set(HiveObjectType objectType, } } + public List list_privileges_for_auth(HiveObjectType objectType, + String db_name, String table_name, List part_values, + String column_name, String user_name, List group_names) + throws HiveException { + try { + HiveObjectRef hiveObj = new HiveObjectRef(objectType, db_name, + table_name, part_values, column_name); + return getMSC().list_privileges_for_auth(hiveObj, user_name, group_names); + } catch (Exception e) { + throw new HiveException(e); + } + } + /** * @param objectType * hive object type diff --git ql/src/java/org/apache/hadoop/hive/ql/plan/PrincipalDesc.java ql/src/java/org/apache/hadoop/hive/ql/plan/PrincipalDesc.java index 7dc0ded..ee46652 100644 --- ql/src/java/org/apache/hadoop/hive/ql/plan/PrincipalDesc.java +++ ql/src/java/org/apache/hadoop/hive/ql/plan/PrincipalDesc.java @@ -59,4 +59,18 @@ public void setType(PrincipalType type) { this.type = type; } + @Override + public int hashCode() { + return name.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof PrincipalDesc)) { + return false; + } + PrincipalDesc other = (PrincipalDesc) obj; + return type == other.type && name.equals(other.name); + } + } diff --git ql/src/java/org/apache/hadoop/hive/ql/security/authorization/BitSetCheckedAuthorizationProvider.java ql/src/java/org/apache/hadoop/hive/ql/security/authorization/BitSetCheckedAuthorizationProvider.java index 2f2ceeb..26479d7 100644 --- ql/src/java/org/apache/hadoop/hive/ql/security/authorization/BitSetCheckedAuthorizationProvider.java +++ ql/src/java/org/apache/hadoop/hive/ql/security/authorization/BitSetCheckedAuthorizationProvider.java @@ -20,18 +20,16 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.HashSet; import java.util.List; -import java.util.Set; import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.metastore.api.HiveObjectType; -import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet; import org.apache.hadoop.hive.metastore.api.PrivilegeGrantInfo; import org.apache.hadoop.hive.ql.metadata.AuthorizationException; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.metadata.Partition; import org.apache.hadoop.hive.ql.metadata.Table; +import org.apache.hadoop.hive.ql.security.HiveAuthenticationProvider; public abstract class BitSetCheckedAuthorizationProvider extends HiveAuthorizationProviderBase { @@ -176,10 +174,10 @@ public void authorize(Table table, Partition part, List columns, boolean[] inputCheck2 = checker2.inputCheck; boolean[] outputCheck2 = checker2.outputCheck; - PrincipalPrivilegeSet partColumnPrivileges = hive_db - .get_privilege_set(HiveObjectType.COLUMN, table.getDbName(), table.getTableName(), + List partColumnPrivileges = hive_db + .list_privileges_for_auth(HiveObjectType.COLUMN, table.getDbName(), table.getTableName(), partValues, col, this.getAuthenticator().getUserName(), this - .getAuthenticator().getGroupNames()); + .getAuthenticator().getGroupNames()); authorizePrivileges(partColumnPrivileges, inputRequiredPriv, inputCheck2, outputRequiredPriv, outputCheck2); @@ -200,9 +198,9 @@ public void authorize(Table table, Partition part, List columns, protected boolean authorizeUserPriv(Privilege[] inputRequiredPriv, boolean[] inputCheck, Privilege[] outputRequiredPriv, boolean[] outputCheck) throws HiveException { - PrincipalPrivilegeSet privileges = hive_db.get_privilege_set( + List privileges = hive_db.list_privileges_for_auth( HiveObjectType.GLOBAL, null, null, null, null, this.getAuthenticator() - .getUserName(), this.getAuthenticator().getGroupNames()); + .getUserName(), this.getAuthenticator().getGroupNames()); return authorizePrivileges(privileges, inputRequiredPriv, inputCheck, outputRequiredPriv, outputCheck); } @@ -230,10 +228,10 @@ private boolean authorizeUserAndDBPriv(Database db, return true; } - PrincipalPrivilegeSet dbPrivileges = hive_db.get_privilege_set( + List dbPrivileges = hive_db.list_privileges_for_auth( HiveObjectType.DATABASE, db.getName(), null, null, null, this - .getAuthenticator().getUserName(), this.getAuthenticator() - .getGroupNames()); + .getAuthenticator().getUserName(), this.getAuthenticator() + .getGroupNames()); if (authorizePrivileges(dbPrivileges, inputRequiredPriv, inputCheck, outputRequiredPriv, outputCheck)) { @@ -263,10 +261,10 @@ private boolean authorizeUserDBAndTable(Table table, return true; } - PrincipalPrivilegeSet tablePrivileges = hive_db.get_privilege_set( + List tablePrivileges = hive_db.list_privileges_for_auth( HiveObjectType.TABLE, table.getDbName(), table.getTableName(), null, null, this.getAuthenticator().getUserName(), this.getAuthenticator() - .getGroupNames()); + .getGroupNames()); if (authorizePrivileges(tablePrivileges, inputRequiredPriv, inputCheck, outputRequiredPriv, outputCheck)) { @@ -291,19 +289,17 @@ private boolean authorizeUserDbAndPartition(Partition part, Privilege[] inputRequiredPriv, Privilege[] outputRequiredPriv, boolean[] inputCheck, boolean[] outputCheck) throws HiveException { + Table table = part.getTable(); if (authorizeUserAndDBPriv( - hive_db.getDatabase(part.getTable().getDbName()), inputRequiredPriv, + hive_db.getDatabase(table.getDbName()), inputRequiredPriv, outputRequiredPriv, inputCheck, outputCheck)) { return true; } - PrincipalPrivilegeSet partPrivileges = part.getTPartition().getPrivileges(); - if (partPrivileges == null) { - partPrivileges = hive_db.get_privilege_set(HiveObjectType.PARTITION, part - .getTable().getDbName(), part.getTable().getTableName(), part - .getValues(), null, this.getAuthenticator().getUserName(), this - .getAuthenticator().getGroupNames()); - } + HiveAuthenticationProvider authenticator = getAuthenticator(); + List partPrivileges = hive_db.list_privileges_for_auth( + HiveObjectType.PARTITION, table.getDbName(), table.getTableName(), part.getValues(), null, + authenticator.getUserName(), authenticator.getGroupNames()); if (authorizePrivileges(partPrivileges, inputRequiredPriv, inputCheck, outputRequiredPriv, outputCheck)) { @@ -313,7 +309,7 @@ private boolean authorizeUserDbAndPartition(Partition part, return false; } - protected boolean authorizePrivileges(PrincipalPrivilegeSet privileges, + protected boolean authorizePrivileges(List privileges, Privilege[] inputPriv, boolean[] inputCheck, Privilege[] outputPriv, boolean[] outputCheck) throws HiveException { @@ -332,8 +328,7 @@ protected boolean authorizePrivileges(PrincipalPrivilegeSet privileges, * * @param container */ - private boolean matchPrivs(Privilege[] inputPriv, - PrincipalPrivilegeSet privileges, boolean[] check) { + private boolean matchPrivs(Privilege[] inputPriv, List privileges, boolean[] check) { if (inputPriv == null) { return true; @@ -343,78 +338,17 @@ private boolean matchPrivs(Privilege[] inputPriv, return false; } - /* - * user grants - */ - Set privSet = new HashSet(); - if (privileges.getUserPrivileges() != null - && privileges.getUserPrivileges().size() > 0) { - Collection> privCollection = privileges.getUserPrivileges().values(); - - List userPrivs = getPrivilegeStringList(privCollection); - if (userPrivs != null && userPrivs.size() > 0) { - for (String priv : userPrivs) { - if (priv == null || priv.trim().equals("")) { - continue; - } - if (priv.equalsIgnoreCase(Privilege.ALL.toString())) { - setBooleanArray(check, true); - return true; - } - privSet.add(priv.toLowerCase()); - } - } - } - - /* - * group grants - */ - if (privileges.getGroupPrivileges() != null - && privileges.getGroupPrivileges().size() > 0) { - Collection> groupPrivCollection = privileges - .getGroupPrivileges().values(); - List groupPrivs = getPrivilegeStringList(groupPrivCollection); - if (groupPrivs != null && groupPrivs.size() > 0) { - for (String priv : groupPrivs) { - if (priv == null || priv.trim().equals("")) { - continue; - } - if (priv.equalsIgnoreCase(Privilege.ALL.toString())) { - setBooleanArray(check, true); - return true; - } - privSet.add(priv.toLowerCase()); - } - } - } - - /* - * roles grants - */ - if (privileges.getRolePrivileges() != null - && privileges.getRolePrivileges().size() > 0) { - Collection> rolePrivsCollection = privileges - .getRolePrivileges().values(); - ; - List rolePrivs = getPrivilegeStringList(rolePrivsCollection); - if (rolePrivs != null && rolePrivs.size() > 0) { - for (String priv : rolePrivs) { - if (priv == null || priv.trim().equals("")) { - continue; - } - if (priv.equalsIgnoreCase(Privilege.ALL.toString())) { - setBooleanArray(check, true); - return true; - } - privSet.add(priv.toLowerCase()); - } + for (String priv : privileges) { + if (priv.equalsIgnoreCase(Privilege.ALL.toString())) { + setBooleanArray(check, true); + return true; } } for (int i = 0; i < inputPriv.length; i++) { String toMatch = inputPriv[i].toString(); if (!check[i]) { - check[i] = privSet.contains(toMatch.toLowerCase()); + check[i] = privileges.contains(toMatch.toLowerCase()); } } diff --git ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java index 18a1b25..4b7b2ed 100644 --- ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java +++ ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java @@ -80,6 +80,25 @@ public PrincipalPrivilegeSet get_privilege_set(HiveObjectType column, String dbN } } + public List list_privileges_for_auth(HiveObjectType column, String dbName, + String tableName, List partValues, String col, String userName, + List groupNames) throws HiveException { + if (!isRunFromMetaStore()) { + return hiveClient.list_privileges_for_auth( + column, dbName, tableName, partValues, col, userName, groupNames); + } else { + HiveObjectRef hiveObj = new HiveObjectRef(column, dbName, + tableName, partValues, col); + try { + return handler.list_privileges_for_auth(hiveObj, userName, groupNames); + } catch (MetaException e) { + throw new HiveException(e); + } catch (TException e) { + throw new HiveException(e); + } + } + } + public Database getDatabase(String dbName) throws HiveException { if (!isRunFromMetaStore()) { return hiveClient.getDatabase(dbName); diff --git ql/src/test/queries/clientpositive/authorization_10.q ql/src/test/queries/clientpositive/authorization_10.q new file mode 100644 index 0000000..ead7b47 --- /dev/null +++ ql/src/test/queries/clientpositive/authorization_10.q @@ -0,0 +1,14 @@ +-- SORT_BEFORE_DIFF + +create table dummy (key string, value string); + +create role role1; +create role role2; + +grant select on table dummy to role role1; +grant role role1 to role role2; +grant role role2 to user hive_test_user; + +set hive.security.authorization.enabled=true; + +select * from dummy; diff --git ql/src/test/results/clientpositive/authorization_10.q.out ql/src/test/results/clientpositive/authorization_10.q.out new file mode 100644 index 0000000..91e196f --- /dev/null +++ ql/src/test/results/clientpositive/authorization_10.q.out @@ -0,0 +1,39 @@ +PREHOOK: query: -- SORT_BEFORE_DIFF + +create table dummy (key string, value string) +PREHOOK: type: CREATETABLE +POSTHOOK: query: -- SORT_BEFORE_DIFF + +create table dummy (key string, value string) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: default@dummy +PREHOOK: query: create role role1 +PREHOOK: type: CREATEROLE +POSTHOOK: query: create role role1 +POSTHOOK: type: CREATEROLE +PREHOOK: query: create role role2 +PREHOOK: type: CREATEROLE +POSTHOOK: query: create role role2 +POSTHOOK: type: CREATEROLE +PREHOOK: query: grant select on table dummy to role role1 +PREHOOK: type: GRANT_PRIVILEGE +PREHOOK: Output: default@dummy +POSTHOOK: query: grant select on table dummy to role role1 +POSTHOOK: type: GRANT_PRIVILEGE +POSTHOOK: Output: default@dummy +PREHOOK: query: grant role role1 to role role2 +PREHOOK: type: GRANT_ROLE +POSTHOOK: query: grant role role1 to role role2 +POSTHOOK: type: GRANT_ROLE +PREHOOK: query: grant role role2 to user hive_test_user +PREHOOK: type: GRANT_ROLE +POSTHOOK: query: grant role role2 to user hive_test_user +POSTHOOK: type: GRANT_ROLE +PREHOOK: query: select * from dummy +PREHOOK: type: QUERY +PREHOOK: Input: default@dummy +#### A masked pattern was here #### +POSTHOOK: query: select * from dummy +POSTHOOK: type: QUERY +POSTHOOK: Input: default@dummy +#### A masked pattern was here #### diff --git ql/src/test/results/clientpositive/authorization_2.q.out ql/src/test/results/clientpositive/authorization_2.q.out index e21d5f5..6582551 100644 --- ql/src/test/results/clientpositive/authorization_2.q.out +++ ql/src/test/results/clientpositive/authorization_2.q.out @@ -53,8 +53,8 @@ PREHOOK: type: SHOW_GRANT POSTHOOK: query: show grant user hive_test_user on table authorization_part POSTHOOK: type: SHOW_GRANT default authorization_part hive_test_user USER Create false -1 hive_test_user -default authorization_part hive_test_user USER Update false -1 hive_test_user default authorization_part hive_test_user USER Drop false -1 hive_test_user +default authorization_part hive_test_user USER Update false -1 hive_test_user PREHOOK: query: alter table authorization_part add partition (ds='2010') PREHOOK: type: ALTERTABLE_ADDPARTS PREHOOK: Input: default@authorization_part @@ -225,8 +225,8 @@ POSTHOOK: type: SHOW_GRANT POSTHOOK: Lineage: authorization_part PARTITION(ds=2010).key EXPRESSION [(src_auth_tmp)src_auth_tmp.FieldSchema(name:key, type:string, comment:null), ] POSTHOOK: Lineage: authorization_part PARTITION(ds=2010).value SIMPLE [(src_auth_tmp)src_auth_tmp.FieldSchema(name:value, type:string, comment:null), ] default authorization_part hive_test_user USER Create false -1 hive_test_user -default authorization_part hive_test_user USER Update false -1 hive_test_user default authorization_part hive_test_user USER Drop false -1 hive_test_user +default authorization_part hive_test_user USER Update false -1 hive_test_user PREHOOK: query: alter table authorization_part add partition (ds='2010') PREHOOK: type: ALTERTABLE_ADDPARTS PREHOOK: Input: default@authorization_part @@ -296,8 +296,8 @@ POSTHOOK: Lineage: authorization_part PARTITION(ds=2010).value SIMPLE [(src_auth POSTHOOK: Lineage: authorization_part PARTITION(ds=2010).key EXPRESSION [(src_auth_tmp)src_auth_tmp.FieldSchema(name:key, type:string, comment:null), ] POSTHOOK: Lineage: authorization_part PARTITION(ds=2010).value SIMPLE [(src_auth_tmp)src_auth_tmp.FieldSchema(name:value, type:string, comment:null), ] default authorization_part hive_test_user USER Create false -1 hive_test_user -default authorization_part hive_test_user USER Update false -1 hive_test_user default authorization_part hive_test_user USER Drop false -1 hive_test_user +default authorization_part hive_test_user USER Update false -1 hive_test_user default authorization_part hive_test_user USER Select false -1 hive_test_user PREHOOK: query: select key from authorization_part where ds='2010' order by key limit 20 PREHOOK: type: QUERY @@ -352,8 +352,8 @@ POSTHOOK: Lineage: authorization_part PARTITION(ds=2010).value SIMPLE [(src_auth POSTHOOK: Lineage: authorization_part PARTITION(ds=2010).key EXPRESSION [(src_auth_tmp)src_auth_tmp.FieldSchema(name:key, type:string, comment:null), ] POSTHOOK: Lineage: authorization_part PARTITION(ds=2010).value SIMPLE [(src_auth_tmp)src_auth_tmp.FieldSchema(name:value, type:string, comment:null), ] default authorization_part hive_test_user USER Create false -1 hive_test_user -default authorization_part hive_test_user USER Update false -1 hive_test_user default authorization_part hive_test_user USER Drop false -1 hive_test_user +default authorization_part hive_test_user USER Update false -1 hive_test_user PREHOOK: query: show grant user hive_test_user on table authorization_part partition (ds='2010') PREHOOK: type: SHOW_GRANT POSTHOOK: query: show grant user hive_test_user on table authorization_part partition (ds='2010') diff --git serde/src/gen/thrift/gen-cpp/serde_constants.cpp serde/src/gen/thrift/gen-cpp/serde_constants.cpp index 3ead1fd..54503e3 100644 --- serde/src/gen/thrift/gen-cpp/serde_constants.cpp +++ serde/src/gen/thrift/gen-cpp/serde_constants.cpp @@ -39,6 +39,10 @@ serdeConstants::serdeConstants() { ESCAPE_CHAR = "escape.delim"; + HEADER_COUNT = "skip.header.line.count"; + + FOOTER_COUNT = "skip.footer.line.count"; + VOID_TYPE_NAME = "void"; BOOLEAN_TYPE_NAME = "boolean"; diff --git serde/src/gen/thrift/gen-cpp/serde_constants.h serde/src/gen/thrift/gen-cpp/serde_constants.h index 37f0b8f..d56c917 100644 --- serde/src/gen/thrift/gen-cpp/serde_constants.h +++ serde/src/gen/thrift/gen-cpp/serde_constants.h @@ -29,6 +29,8 @@ class serdeConstants { std::string MAPKEY_DELIM; std::string QUOTE_CHAR; std::string ESCAPE_CHAR; + std::string HEADER_COUNT; + std::string FOOTER_COUNT; std::string VOID_TYPE_NAME; std::string BOOLEAN_TYPE_NAME; std::string TINYINT_TYPE_NAME; diff --git serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java index dda3c5f..1b708dd 100644 --- serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java +++ serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java @@ -528,7 +528,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftTestObj struc struct.field3 = new ArrayList(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { - InnerStruct _elem2; // optional + InnerStruct _elem2; // required _elem2 = new InnerStruct(); _elem2.read(iprot); struct.field3.add(_elem2); @@ -636,7 +636,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, ThriftTestObj struct struct.field3 = new ArrayList(_list5.size); for (int _i6 = 0; _i6 < _list5.size; ++_i6) { - InnerStruct _elem7; // optional + InnerStruct _elem7; // required _elem7 = new InnerStruct(); _elem7.read(iprot); struct.field3.add(_elem7); diff --git serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java index aa404bf..e36a792 100644 --- serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java +++ serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java @@ -836,7 +836,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) thr struct.lint = new ArrayList(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { - int _elem2; // optional + int _elem2; // required _elem2 = iprot.readI32(); struct.lint.add(_elem2); } @@ -854,7 +854,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) thr struct.lString = new ArrayList(_list3.size); for (int _i4 = 0; _i4 < _list3.size; ++_i4) { - String _elem5; // optional + String _elem5; // required _elem5 = iprot.readString(); struct.lString.add(_elem5); } @@ -872,7 +872,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) thr struct.lintString = new ArrayList(_list6.size); for (int _i7 = 0; _i7 < _list6.size; ++_i7) { - IntString _elem8; // optional + IntString _elem8; // required _elem8 = new IntString(); _elem8.read(iprot); struct.lintString.add(_elem8); @@ -1074,7 +1074,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) thro struct.lint = new ArrayList(_list21.size); for (int _i22 = 0; _i22 < _list21.size; ++_i22) { - int _elem23; // optional + int _elem23; // required _elem23 = iprot.readI32(); struct.lint.add(_elem23); } @@ -1087,7 +1087,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) thro struct.lString = new ArrayList(_list24.size); for (int _i25 = 0; _i25 < _list24.size; ++_i25) { - String _elem26; // optional + String _elem26; // required _elem26 = iprot.readString(); struct.lString.add(_elem26); } @@ -1100,7 +1100,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) thro struct.lintString = new ArrayList(_list27.size); for (int _i28 = 0; _i28 < _list27.size; ++_i28) { - IntString _elem29; // optional + IntString _elem29; // required _elem29 = new IntString(); _elem29.read(iprot); struct.lintString.add(_elem29); diff --git serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java index fba49e4..86a7cad 100644 --- serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java +++ serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java @@ -2192,7 +2192,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i1 = 0; _i1 < _map0.size; ++_i1) { String _key2; // required - String _val3; // required + String _val3; // optional _key2 = iprot.readString(); _val3 = iprot.readString(); struct.my_string_string_map.put(_key2, _val3); @@ -2212,7 +2212,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i5 = 0; _i5 < _map4.size; ++_i5) { String _key6; // required - MyEnum _val7; // required + MyEnum _val7; // optional _key6 = iprot.readString(); _val7 = MyEnum.findByValue(iprot.readI32()); struct.my_string_enum_map.put(_key6, _val7); @@ -2232,7 +2232,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i9 = 0; _i9 < _map8.size; ++_i9) { MyEnum _key10; // required - String _val11; // required + String _val11; // optional _key10 = MyEnum.findByValue(iprot.readI32()); _val11 = iprot.readString(); struct.my_enum_string_map.put(_key10, _val11); @@ -2280,7 +2280,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) _val19 = new ArrayList(_list20.size); for (int _i21 = 0; _i21 < _list20.size; ++_i21) { - String _elem22; // optional + String _elem22; // required _elem22 = iprot.readString(); _val19.add(_elem22); } @@ -2310,7 +2310,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) _val26 = new ArrayList(_list27.size); for (int _i28 = 0; _i28 < _list27.size; ++_i28) { - MiniStruct _elem29; // optional + MiniStruct _elem29; // required _elem29 = new MiniStruct(); _elem29.read(iprot); _val26.add(_elem29); @@ -2333,7 +2333,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_stringlist = new ArrayList(_list30.size); for (int _i31 = 0; _i31 < _list30.size; ++_i31) { - String _elem32; // optional + String _elem32; // required _elem32 = iprot.readString(); struct.my_stringlist.add(_elem32); } @@ -2351,7 +2351,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_structlist = new ArrayList(_list33.size); for (int _i34 = 0; _i34 < _list33.size; ++_i34) { - MiniStruct _elem35; // optional + MiniStruct _elem35; // required _elem35 = new MiniStruct(); _elem35.read(iprot); struct.my_structlist.add(_elem35); @@ -2370,7 +2370,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_enumlist = new ArrayList(_list36.size); for (int _i37 = 0; _i37 < _list36.size; ++_i37) { - MyEnum _elem38; // optional + MyEnum _elem38; // required _elem38 = MyEnum.findByValue(iprot.readI32()); struct.my_enumlist.add(_elem38); } @@ -2388,7 +2388,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_stringset = new HashSet(2*_set39.size); for (int _i40 = 0; _i40 < _set39.size; ++_i40) { - String _elem41; // optional + String _elem41; // required _elem41 = iprot.readString(); struct.my_stringset.add(_elem41); } @@ -2406,7 +2406,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_enumset = new HashSet(2*_set42.size); for (int _i43 = 0; _i43 < _set42.size; ++_i43) { - MyEnum _elem44; // optional + MyEnum _elem44; // required _elem44 = MyEnum.findByValue(iprot.readI32()); struct.my_enumset.add(_elem44); } @@ -2424,7 +2424,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_structset = new HashSet(2*_set45.size); for (int _i46 = 0; _i46 < _set45.size; ++_i46) { - MiniStruct _elem47; // optional + MiniStruct _elem47; // required _elem47 = new MiniStruct(); _elem47.read(iprot); struct.my_structset.add(_elem47); @@ -3023,7 +3023,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t _val95 = new ArrayList(_list96.size); for (int _i97 = 0; _i97 < _list96.size; ++_i97) { - String _elem98; // optional + String _elem98; // required _elem98 = iprot.readString(); _val95.add(_elem98); } @@ -3047,7 +3047,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t _val102 = new ArrayList(_list103.size); for (int _i104 = 0; _i104 < _list103.size; ++_i104) { - MiniStruct _elem105; // optional + MiniStruct _elem105; // required _elem105 = new MiniStruct(); _elem105.read(iprot); _val102.add(_elem105); @@ -3064,7 +3064,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_stringlist = new ArrayList(_list106.size); for (int _i107 = 0; _i107 < _list106.size; ++_i107) { - String _elem108; // optional + String _elem108; // required _elem108 = iprot.readString(); struct.my_stringlist.add(_elem108); } @@ -3077,7 +3077,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_structlist = new ArrayList(_list109.size); for (int _i110 = 0; _i110 < _list109.size; ++_i110) { - MiniStruct _elem111; // optional + MiniStruct _elem111; // required _elem111 = new MiniStruct(); _elem111.read(iprot); struct.my_structlist.add(_elem111); @@ -3091,7 +3091,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_enumlist = new ArrayList(_list112.size); for (int _i113 = 0; _i113 < _list112.size; ++_i113) { - MyEnum _elem114; // optional + MyEnum _elem114; // required _elem114 = MyEnum.findByValue(iprot.readI32()); struct.my_enumlist.add(_elem114); } @@ -3104,7 +3104,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_stringset = new HashSet(2*_set115.size); for (int _i116 = 0; _i116 < _set115.size; ++_i116) { - String _elem117; // optional + String _elem117; // required _elem117 = iprot.readString(); struct.my_stringset.add(_elem117); } @@ -3117,7 +3117,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_enumset = new HashSet(2*_set118.size); for (int _i119 = 0; _i119 < _set118.size; ++_i119) { - MyEnum _elem120; // optional + MyEnum _elem120; // required _elem120 = MyEnum.findByValue(iprot.readI32()); struct.my_enumset.add(_elem120); } @@ -3130,7 +3130,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_structset = new HashSet(2*_set121.size); for (int _i122 = 0; _i122 < _set121.size; ++_i122) { - MiniStruct _elem123; // optional + MiniStruct _elem123; // required _elem123 = new MiniStruct(); _elem123.read(iprot); struct.my_structset.add(_elem123); diff --git serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php index ecbee27..837dd11 100644 --- serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php +++ serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php @@ -44,6 +44,10 @@ $GLOBALS['serde_CONSTANTS']['QUOTE_CHAR'] = "quote.delim"; $GLOBALS['serde_CONSTANTS']['ESCAPE_CHAR'] = "escape.delim"; +$GLOBALS['serde_CONSTANTS']['HEADER_COUNT'] = "skip.header.line.count"; + +$GLOBALS['serde_CONSTANTS']['FOOTER_COUNT'] = "skip.footer.line.count"; + $GLOBALS['serde_CONSTANTS']['VOID_TYPE_NAME'] = "void"; $GLOBALS['serde_CONSTANTS']['BOOLEAN_TYPE_NAME'] = "boolean"; diff --git serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py index 474b775..8eac87d 100644 --- serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py +++ serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py @@ -23,6 +23,8 @@ MAPKEY_DELIM = "mapkey.delim" QUOTE_CHAR = "quote.delim" ESCAPE_CHAR = "escape.delim" +HEADER_COUNT = "skip.header.line.count" +FOOTER_COUNT = "skip.footer.line.count" VOID_TYPE_NAME = "void" BOOLEAN_TYPE_NAME = "boolean" TINYINT_TYPE_NAME = "tinyint" diff --git serde/src/gen/thrift/gen-rb/serde_constants.rb serde/src/gen/thrift/gen-rb/serde_constants.rb index 248418d..ed86522 100644 --- serde/src/gen/thrift/gen-rb/serde_constants.rb +++ serde/src/gen/thrift/gen-rb/serde_constants.rb @@ -35,6 +35,10 @@ QUOTE_CHAR = %q"quote.delim" ESCAPE_CHAR = %q"escape.delim" +HEADER_COUNT = %q"skip.header.line.count" + +FOOTER_COUNT = %q"skip.footer.line.count" + VOID_TYPE_NAME = %q"void" BOOLEAN_TYPE_NAME = %q"boolean" diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeQualifiers.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeQualifiers.java index 3935555..4c06c1a 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeQualifiers.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeQualifiers.java @@ -360,7 +360,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TTypeQualifiers str for (int _i1 = 0; _i1 < _map0.size; ++_i1) { String _key2; // required - TTypeQualifierValue _val3; // required + TTypeQualifierValue _val3; // optional _key2 = iprot.readString(); _val3 = new TTypeQualifierValue(); _val3.read(iprot); @@ -435,7 +435,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TTypeQualifiers stru for (int _i7 = 0; _i7 < _map6.size; ++_i7) { String _key8; // required - TTypeQualifierValue _val9; // required + TTypeQualifierValue _val9; // optional _key8 = iprot.readString(); _val9 = new TTypeQualifierValue(); _val9.read(iprot); diff --git service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote old mode 100644 new mode 100755 diff --git service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote old mode 100644 new mode 100755