diff --git a/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java b/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java index 7e54d1f..9d73470 100644 --- a/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java +++ b/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java @@ -35,11 +35,15 @@ import org.apache.hive.service.rpc.thrift.TGetCatalogsResp; import org.apache.hive.service.rpc.thrift.TGetColumnsReq; import org.apache.hive.service.rpc.thrift.TGetColumnsResp; +import org.apache.hive.service.rpc.thrift.TGetCrossReferenceReq; +import org.apache.hive.service.rpc.thrift.TGetCrossReferenceResp; import org.apache.hive.service.rpc.thrift.TGetFunctionsReq; import org.apache.hive.service.rpc.thrift.TGetFunctionsResp; import org.apache.hive.service.rpc.thrift.TGetInfoReq; import org.apache.hive.service.rpc.thrift.TGetInfoResp; import org.apache.hive.service.rpc.thrift.TGetInfoType; +import org.apache.hive.service.rpc.thrift.TGetPrimaryKeysReq; +import org.apache.hive.service.rpc.thrift.TGetPrimaryKeysResp; import org.apache.hive.service.rpc.thrift.TGetSchemasReq; import org.apache.hive.service.rpc.thrift.TGetSchemasResp; import org.apache.hive.service.rpc.thrift.TGetTableTypesReq; @@ -255,7 +259,27 @@ public Connection getConnection() throws SQLException { public ResultSet getCrossReference(String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException { - throw new SQLException("Method not supported"); + TGetCrossReferenceResp getFKResp; + TGetCrossReferenceReq getFKReq = new TGetCrossReferenceReq(sessHandle); + getFKReq.setParentTableName(primaryTable); + getFKReq.setParentSchemaName(primarySchema); + getFKReq.setParentCatalogName(primaryCatalog); + getFKReq.setForeignTableName(foreignTable); + getFKReq.setForeignSchemaName(foreignSchema); + getFKReq.setForeignCatalogName(foreignCatalog); + + try { + getFKResp = client.GetCrossReference(getFKReq); + } catch (TException e) { + throw new SQLException(e.getMessage(), "08S01", e); + } + Utils.verifySuccess(getFKResp.getStatus()); + + return new HiveQueryResultSet.Builder(connection) + .setClient(client) + .setSessionHandle(sessHandle) + .setStmtHandle(getFKResp.getOperationHandle()) + .build(); } public int getDatabaseMajorVersion() throws SQLException { @@ -493,12 +517,23 @@ public String getNumericFunctions() throws SQLException { public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { - // Hive doesn't support primary keys - // using local schema with empty resultset - return new HiveQueryResultSet.Builder(connection).setClient(client).setEmptyResultSet(true). - setSchema(Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ", "PK_NAME" ), - Arrays.asList("STRING", "STRING", "STRING", "STRING", "INT", "STRING")) - .build(); + TGetPrimaryKeysResp getPKResp; + TGetPrimaryKeysReq getPKReq = new TGetPrimaryKeysReq(sessHandle); + getPKReq.setTableName(table); + getPKReq.setSchemaName(schema); + getPKReq.setCatalogName(catalog); + try { + getPKResp = client.GetPrimaryKeys(getPKReq); + } catch (TException e) { + throw new SQLException(e.getMessage(), "08S01", e); + } + Utils.verifySuccess(getPKResp.getStatus()); + + return new HiveQueryResultSet.Builder(connection) + .setClient(client) + .setSessionHandle(sessHandle) + .setStmtHandle(getPKResp.getOperationHandle()) + .build(); } public ResultSet getProcedureColumns(String catalog, String schemaPattern, diff --git a/service-rpc/if/TCLIService.thrift b/service-rpc/if/TCLIService.thrift index aa28b6e..efe7750 100644 --- a/service-rpc/if/TCLIService.thrift +++ b/service-rpc/if/TCLIService.thrift @@ -955,6 +955,52 @@ struct TGetFunctionsResp { 2: optional TOperationHandle operationHandle } +struct TGetPrimaryKeysReq { + // Session to run this request against + 1: required TSessionHandle sessionHandle + + // Name of the catalog. + 2: optional TIdentifier catalogName + + // Name of the schema. + 3: optional TIdentifier schemaName + + // Name of the table. + 4: optional TIdentifier tableName +} + +struct TGetPrimaryKeysResp { + 1: required TStatus status + 2: optional TOperationHandle operationHandle +} + +struct TGetCrossReferenceReq { + // Session to run this request against + 1: required TSessionHandle sessionHandle + + // Name of the parent catalog. + 2: optional TIdentifier parentCatalogName + + // Name of the parent schema. + 3: optional TIdentifier parentSchemaName + + // Name of the parent table. + 4: optional TIdentifier parentTableName + + // Name of the foreign catalog. + 5: optional TIdentifier foreignCatalogName + + // Name of the foreign schema. + 6: optional TIdentifier foreignSchemaName + + // Name of the foreign table. + 7: optional TIdentifier foreignTableName +} + +struct TGetCrossReferenceResp { + 1: required TStatus status + 2: optional TOperationHandle operationHandle +} // GetOperationStatus() // @@ -1165,6 +1211,10 @@ service TCLIService { TGetFunctionsResp GetFunctions(1:TGetFunctionsReq req); + TGetPrimaryKeysResp GetPrimaryKeys(1:TGetPrimaryKeysReq req); + + TGetCrossReferenceResp GetCrossReference(1:TGetCrossReferenceReq req); + TGetOperationStatusResp GetOperationStatus(1:TGetOperationStatusReq req); TCancelOperationResp CancelOperation(1:TCancelOperationReq req); diff --git a/service-rpc/src/gen/thrift/gen-cpp/TCLIService.cpp b/service-rpc/src/gen/thrift/gen-cpp/TCLIService.cpp index fc82b88..3597d44 100644 --- a/service-rpc/src/gen/thrift/gen-cpp/TCLIService.cpp +++ b/service-rpc/src/gen/thrift/gen-cpp/TCLIService.cpp @@ -2066,6 +2066,380 @@ uint32_t TCLIService_GetFunctions_presult::read(::apache::thrift::protocol::TPro } +TCLIService_GetPrimaryKeys_args::~TCLIService_GetPrimaryKeys_args() throw() { +} + + +uint32_t TCLIService_GetPrimaryKeys_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->req.read(iprot); + this->__isset.req = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t TCLIService_GetPrimaryKeys_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TCLIService_GetPrimaryKeys_args"); + + xfer += oprot->writeFieldBegin("req", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->req.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +TCLIService_GetPrimaryKeys_pargs::~TCLIService_GetPrimaryKeys_pargs() throw() { +} + + +uint32_t TCLIService_GetPrimaryKeys_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TCLIService_GetPrimaryKeys_pargs"); + + xfer += oprot->writeFieldBegin("req", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->req)).write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +TCLIService_GetPrimaryKeys_result::~TCLIService_GetPrimaryKeys_result() throw() { +} + + +uint32_t TCLIService_GetPrimaryKeys_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->success.read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t TCLIService_GetPrimaryKeys_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("TCLIService_GetPrimaryKeys_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); + xfer += this->success.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +TCLIService_GetPrimaryKeys_presult::~TCLIService_GetPrimaryKeys_presult() throw() { +} + + +uint32_t TCLIService_GetPrimaryKeys_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += (*(this->success)).read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + + +TCLIService_GetCrossReference_args::~TCLIService_GetCrossReference_args() throw() { +} + + +uint32_t TCLIService_GetCrossReference_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->req.read(iprot); + this->__isset.req = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t TCLIService_GetCrossReference_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TCLIService_GetCrossReference_args"); + + xfer += oprot->writeFieldBegin("req", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->req.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +TCLIService_GetCrossReference_pargs::~TCLIService_GetCrossReference_pargs() throw() { +} + + +uint32_t TCLIService_GetCrossReference_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TCLIService_GetCrossReference_pargs"); + + xfer += oprot->writeFieldBegin("req", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->req)).write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +TCLIService_GetCrossReference_result::~TCLIService_GetCrossReference_result() throw() { +} + + +uint32_t TCLIService_GetCrossReference_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->success.read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t TCLIService_GetCrossReference_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("TCLIService_GetCrossReference_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); + xfer += this->success.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +TCLIService_GetCrossReference_presult::~TCLIService_GetCrossReference_presult() throw() { +} + + +uint32_t TCLIService_GetCrossReference_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += (*(this->success)).read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + + TCLIService_GetOperationStatus_args::~TCLIService_GetOperationStatus_args() throw() { } @@ -4065,12 +4439,128 @@ void TCLIServiceClient::recv_GetTableTypes(TGetTableTypesResp& _return) iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } - if (fname.compare("GetTableTypes") != 0) { + if (fname.compare("GetTableTypes") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + TCLIService_GetTableTypes_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetTableTypes failed: unknown result"); +} + +void TCLIServiceClient::GetColumns(TGetColumnsResp& _return, const TGetColumnsReq& req) +{ + send_GetColumns(req); + recv_GetColumns(_return); +} + +void TCLIServiceClient::send_GetColumns(const TGetColumnsReq& req) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("GetColumns", ::apache::thrift::protocol::T_CALL, cseqid); + + TCLIService_GetColumns_pargs args; + args.req = &req; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void TCLIServiceClient::recv_GetColumns(TGetColumnsResp& _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("GetColumns") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + TCLIService_GetColumns_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetColumns failed: unknown result"); +} + +void TCLIServiceClient::GetFunctions(TGetFunctionsResp& _return, const TGetFunctionsReq& req) +{ + send_GetFunctions(req); + recv_GetFunctions(_return); +} + +void TCLIServiceClient::send_GetFunctions(const TGetFunctionsReq& req) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("GetFunctions", ::apache::thrift::protocol::T_CALL, cseqid); + + TCLIService_GetFunctions_pargs args; + args.req = &req; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void TCLIServiceClient::recv_GetFunctions(TGetFunctionsResp& _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("GetFunctions") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } - TCLIService_GetTableTypes_presult result; + TCLIService_GetFunctions_presult result; result.success = &_return; result.read(iprot_); iprot_->readMessageEnd(); @@ -4080,21 +4570,21 @@ void TCLIServiceClient::recv_GetTableTypes(TGetTableTypesResp& _return) // _return pointer has now been filled return; } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetTableTypes failed: unknown result"); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetFunctions failed: unknown result"); } -void TCLIServiceClient::GetColumns(TGetColumnsResp& _return, const TGetColumnsReq& req) +void TCLIServiceClient::GetPrimaryKeys(TGetPrimaryKeysResp& _return, const TGetPrimaryKeysReq& req) { - send_GetColumns(req); - recv_GetColumns(_return); + send_GetPrimaryKeys(req); + recv_GetPrimaryKeys(_return); } -void TCLIServiceClient::send_GetColumns(const TGetColumnsReq& req) +void TCLIServiceClient::send_GetPrimaryKeys(const TGetPrimaryKeysReq& req) { int32_t cseqid = 0; - oprot_->writeMessageBegin("GetColumns", ::apache::thrift::protocol::T_CALL, cseqid); + oprot_->writeMessageBegin("GetPrimaryKeys", ::apache::thrift::protocol::T_CALL, cseqid); - TCLIService_GetColumns_pargs args; + TCLIService_GetPrimaryKeys_pargs args; args.req = &req; args.write(oprot_); @@ -4103,7 +4593,7 @@ void TCLIServiceClient::send_GetColumns(const TGetColumnsReq& req) oprot_->getTransport()->flush(); } -void TCLIServiceClient::recv_GetColumns(TGetColumnsResp& _return) +void TCLIServiceClient::recv_GetPrimaryKeys(TGetPrimaryKeysResp& _return) { int32_t rseqid = 0; @@ -4123,12 +4613,12 @@ void TCLIServiceClient::recv_GetColumns(TGetColumnsResp& _return) iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } - if (fname.compare("GetColumns") != 0) { + if (fname.compare("GetPrimaryKeys") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } - TCLIService_GetColumns_presult result; + TCLIService_GetPrimaryKeys_presult result; result.success = &_return; result.read(iprot_); iprot_->readMessageEnd(); @@ -4138,21 +4628,21 @@ void TCLIServiceClient::recv_GetColumns(TGetColumnsResp& _return) // _return pointer has now been filled return; } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetColumns failed: unknown result"); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetPrimaryKeys failed: unknown result"); } -void TCLIServiceClient::GetFunctions(TGetFunctionsResp& _return, const TGetFunctionsReq& req) +void TCLIServiceClient::GetCrossReference(TGetCrossReferenceResp& _return, const TGetCrossReferenceReq& req) { - send_GetFunctions(req); - recv_GetFunctions(_return); + send_GetCrossReference(req); + recv_GetCrossReference(_return); } -void TCLIServiceClient::send_GetFunctions(const TGetFunctionsReq& req) +void TCLIServiceClient::send_GetCrossReference(const TGetCrossReferenceReq& req) { int32_t cseqid = 0; - oprot_->writeMessageBegin("GetFunctions", ::apache::thrift::protocol::T_CALL, cseqid); + oprot_->writeMessageBegin("GetCrossReference", ::apache::thrift::protocol::T_CALL, cseqid); - TCLIService_GetFunctions_pargs args; + TCLIService_GetCrossReference_pargs args; args.req = &req; args.write(oprot_); @@ -4161,7 +4651,7 @@ void TCLIServiceClient::send_GetFunctions(const TGetFunctionsReq& req) oprot_->getTransport()->flush(); } -void TCLIServiceClient::recv_GetFunctions(TGetFunctionsResp& _return) +void TCLIServiceClient::recv_GetCrossReference(TGetCrossReferenceResp& _return) { int32_t rseqid = 0; @@ -4181,12 +4671,12 @@ void TCLIServiceClient::recv_GetFunctions(TGetFunctionsResp& _return) iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } - if (fname.compare("GetFunctions") != 0) { + if (fname.compare("GetCrossReference") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } - TCLIService_GetFunctions_presult result; + TCLIService_GetCrossReference_presult result; result.success = &_return; result.read(iprot_); iprot_->readMessageEnd(); @@ -4196,7 +4686,7 @@ void TCLIServiceClient::recv_GetFunctions(TGetFunctionsResp& _return) // _return pointer has now been filled return; } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetFunctions failed: unknown result"); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetCrossReference failed: unknown result"); } void TCLIServiceClient::GetOperationStatus(TGetOperationStatusResp& _return, const TGetOperationStatusReq& req) @@ -5276,6 +5766,114 @@ void TCLIServiceProcessor::process_GetFunctions(int32_t seqid, ::apache::thrift: } } +void TCLIServiceProcessor::process_GetPrimaryKeys(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("TCLIService.GetPrimaryKeys", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "TCLIService.GetPrimaryKeys"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "TCLIService.GetPrimaryKeys"); + } + + TCLIService_GetPrimaryKeys_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "TCLIService.GetPrimaryKeys", bytes); + } + + TCLIService_GetPrimaryKeys_result result; + try { + iface_->GetPrimaryKeys(result.success, args.req); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "TCLIService.GetPrimaryKeys"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("GetPrimaryKeys", ::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, "TCLIService.GetPrimaryKeys"); + } + + oprot->writeMessageBegin("GetPrimaryKeys", ::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, "TCLIService.GetPrimaryKeys", bytes); + } +} + +void TCLIServiceProcessor::process_GetCrossReference(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("TCLIService.GetCrossReference", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "TCLIService.GetCrossReference"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "TCLIService.GetCrossReference"); + } + + TCLIService_GetCrossReference_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "TCLIService.GetCrossReference", bytes); + } + + TCLIService_GetCrossReference_result result; + try { + iface_->GetCrossReference(result.success, args.req); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "TCLIService.GetCrossReference"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("GetCrossReference", ::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, "TCLIService.GetCrossReference"); + } + + oprot->writeMessageBegin("GetCrossReference", ::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, "TCLIService.GetCrossReference", bytes); + } +} + void TCLIServiceProcessor::process_GetOperationStatus(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) { void* ctx = NULL; @@ -6639,6 +7237,174 @@ void TCLIServiceConcurrentClient::recv_GetFunctions(TGetFunctionsResp& _return, } // end while(true) } +void TCLIServiceConcurrentClient::GetPrimaryKeys(TGetPrimaryKeysResp& _return, const TGetPrimaryKeysReq& req) +{ + int32_t seqid = send_GetPrimaryKeys(req); + recv_GetPrimaryKeys(_return, seqid); +} + +int32_t TCLIServiceConcurrentClient::send_GetPrimaryKeys(const TGetPrimaryKeysReq& req) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("GetPrimaryKeys", ::apache::thrift::protocol::T_CALL, cseqid); + + TCLIService_GetPrimaryKeys_pargs args; + args.req = &req; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void TCLIServiceConcurrentClient::recv_GetPrimaryKeys(TGetPrimaryKeysResp& _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("GetPrimaryKeys") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + TCLIService_GetPrimaryKeys_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetPrimaryKeys failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + +void TCLIServiceConcurrentClient::GetCrossReference(TGetCrossReferenceResp& _return, const TGetCrossReferenceReq& req) +{ + int32_t seqid = send_GetCrossReference(req); + recv_GetCrossReference(_return, seqid); +} + +int32_t TCLIServiceConcurrentClient::send_GetCrossReference(const TGetCrossReferenceReq& req) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("GetCrossReference", ::apache::thrift::protocol::T_CALL, cseqid); + + TCLIService_GetCrossReference_pargs args; + args.req = &req; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void TCLIServiceConcurrentClient::recv_GetCrossReference(TGetCrossReferenceResp& _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("GetCrossReference") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + TCLIService_GetCrossReference_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetCrossReference failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + void TCLIServiceConcurrentClient::GetOperationStatus(TGetOperationStatusResp& _return, const TGetOperationStatusReq& req) { int32_t seqid = send_GetOperationStatus(req); diff --git a/service-rpc/src/gen/thrift/gen-cpp/TCLIService.h b/service-rpc/src/gen/thrift/gen-cpp/TCLIService.h index 3407564..5fd423d 100644 --- a/service-rpc/src/gen/thrift/gen-cpp/TCLIService.h +++ b/service-rpc/src/gen/thrift/gen-cpp/TCLIService.h @@ -32,6 +32,8 @@ class TCLIServiceIf { virtual void GetTableTypes(TGetTableTypesResp& _return, const TGetTableTypesReq& req) = 0; virtual void GetColumns(TGetColumnsResp& _return, const TGetColumnsReq& req) = 0; virtual void GetFunctions(TGetFunctionsResp& _return, const TGetFunctionsReq& req) = 0; + virtual void GetPrimaryKeys(TGetPrimaryKeysResp& _return, const TGetPrimaryKeysReq& req) = 0; + virtual void GetCrossReference(TGetCrossReferenceResp& _return, const TGetCrossReferenceReq& req) = 0; virtual void GetOperationStatus(TGetOperationStatusResp& _return, const TGetOperationStatusReq& req) = 0; virtual void CancelOperation(TCancelOperationResp& _return, const TCancelOperationReq& req) = 0; virtual void CloseOperation(TCloseOperationResp& _return, const TCloseOperationReq& req) = 0; @@ -102,6 +104,12 @@ class TCLIServiceNull : virtual public TCLIServiceIf { void GetFunctions(TGetFunctionsResp& /* _return */, const TGetFunctionsReq& /* req */) { return; } + void GetPrimaryKeys(TGetPrimaryKeysResp& /* _return */, const TGetPrimaryKeysReq& /* req */) { + return; + } + void GetCrossReference(TGetCrossReferenceResp& /* _return */, const TGetCrossReferenceReq& /* req */) { + return; + } void GetOperationStatus(TGetOperationStatusResp& /* _return */, const TGetOperationStatusReq& /* req */) { return; } @@ -1272,6 +1280,214 @@ class TCLIService_GetFunctions_presult { }; +typedef struct _TCLIService_GetPrimaryKeys_args__isset { + _TCLIService_GetPrimaryKeys_args__isset() : req(false) {} + bool req :1; +} _TCLIService_GetPrimaryKeys_args__isset; + +class TCLIService_GetPrimaryKeys_args { + public: + + TCLIService_GetPrimaryKeys_args(const TCLIService_GetPrimaryKeys_args&); + TCLIService_GetPrimaryKeys_args& operator=(const TCLIService_GetPrimaryKeys_args&); + TCLIService_GetPrimaryKeys_args() { + } + + virtual ~TCLIService_GetPrimaryKeys_args() throw(); + TGetPrimaryKeysReq req; + + _TCLIService_GetPrimaryKeys_args__isset __isset; + + void __set_req(const TGetPrimaryKeysReq& val); + + bool operator == (const TCLIService_GetPrimaryKeys_args & rhs) const + { + if (!(req == rhs.req)) + return false; + return true; + } + bool operator != (const TCLIService_GetPrimaryKeys_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCLIService_GetPrimaryKeys_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class TCLIService_GetPrimaryKeys_pargs { + public: + + + virtual ~TCLIService_GetPrimaryKeys_pargs() throw(); + const TGetPrimaryKeysReq* req; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TCLIService_GetPrimaryKeys_result__isset { + _TCLIService_GetPrimaryKeys_result__isset() : success(false) {} + bool success :1; +} _TCLIService_GetPrimaryKeys_result__isset; + +class TCLIService_GetPrimaryKeys_result { + public: + + TCLIService_GetPrimaryKeys_result(const TCLIService_GetPrimaryKeys_result&); + TCLIService_GetPrimaryKeys_result& operator=(const TCLIService_GetPrimaryKeys_result&); + TCLIService_GetPrimaryKeys_result() { + } + + virtual ~TCLIService_GetPrimaryKeys_result() throw(); + TGetPrimaryKeysResp success; + + _TCLIService_GetPrimaryKeys_result__isset __isset; + + void __set_success(const TGetPrimaryKeysResp& val); + + bool operator == (const TCLIService_GetPrimaryKeys_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const TCLIService_GetPrimaryKeys_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCLIService_GetPrimaryKeys_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TCLIService_GetPrimaryKeys_presult__isset { + _TCLIService_GetPrimaryKeys_presult__isset() : success(false) {} + bool success :1; +} _TCLIService_GetPrimaryKeys_presult__isset; + +class TCLIService_GetPrimaryKeys_presult { + public: + + + virtual ~TCLIService_GetPrimaryKeys_presult() throw(); + TGetPrimaryKeysResp* success; + + _TCLIService_GetPrimaryKeys_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _TCLIService_GetCrossReference_args__isset { + _TCLIService_GetCrossReference_args__isset() : req(false) {} + bool req :1; +} _TCLIService_GetCrossReference_args__isset; + +class TCLIService_GetCrossReference_args { + public: + + TCLIService_GetCrossReference_args(const TCLIService_GetCrossReference_args&); + TCLIService_GetCrossReference_args& operator=(const TCLIService_GetCrossReference_args&); + TCLIService_GetCrossReference_args() { + } + + virtual ~TCLIService_GetCrossReference_args() throw(); + TGetCrossReferenceReq req; + + _TCLIService_GetCrossReference_args__isset __isset; + + void __set_req(const TGetCrossReferenceReq& val); + + bool operator == (const TCLIService_GetCrossReference_args & rhs) const + { + if (!(req == rhs.req)) + return false; + return true; + } + bool operator != (const TCLIService_GetCrossReference_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCLIService_GetCrossReference_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class TCLIService_GetCrossReference_pargs { + public: + + + virtual ~TCLIService_GetCrossReference_pargs() throw(); + const TGetCrossReferenceReq* req; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TCLIService_GetCrossReference_result__isset { + _TCLIService_GetCrossReference_result__isset() : success(false) {} + bool success :1; +} _TCLIService_GetCrossReference_result__isset; + +class TCLIService_GetCrossReference_result { + public: + + TCLIService_GetCrossReference_result(const TCLIService_GetCrossReference_result&); + TCLIService_GetCrossReference_result& operator=(const TCLIService_GetCrossReference_result&); + TCLIService_GetCrossReference_result() { + } + + virtual ~TCLIService_GetCrossReference_result() throw(); + TGetCrossReferenceResp success; + + _TCLIService_GetCrossReference_result__isset __isset; + + void __set_success(const TGetCrossReferenceResp& val); + + bool operator == (const TCLIService_GetCrossReference_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const TCLIService_GetCrossReference_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCLIService_GetCrossReference_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TCLIService_GetCrossReference_presult__isset { + _TCLIService_GetCrossReference_presult__isset() : success(false) {} + bool success :1; +} _TCLIService_GetCrossReference_presult__isset; + +class TCLIService_GetCrossReference_presult { + public: + + + virtual ~TCLIService_GetCrossReference_presult() throw(); + TGetCrossReferenceResp* success; + + _TCLIService_GetCrossReference_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + typedef struct _TCLIService_GetOperationStatus_args__isset { _TCLIService_GetOperationStatus_args__isset() : req(false) {} bool req :1; @@ -2162,6 +2378,12 @@ class TCLIServiceClient : virtual public TCLIServiceIf { void GetFunctions(TGetFunctionsResp& _return, const TGetFunctionsReq& req); void send_GetFunctions(const TGetFunctionsReq& req); void recv_GetFunctions(TGetFunctionsResp& _return); + void GetPrimaryKeys(TGetPrimaryKeysResp& _return, const TGetPrimaryKeysReq& req); + void send_GetPrimaryKeys(const TGetPrimaryKeysReq& req); + void recv_GetPrimaryKeys(TGetPrimaryKeysResp& _return); + void GetCrossReference(TGetCrossReferenceResp& _return, const TGetCrossReferenceReq& req); + void send_GetCrossReference(const TGetCrossReferenceReq& req); + void recv_GetCrossReference(TGetCrossReferenceResp& _return); void GetOperationStatus(TGetOperationStatusResp& _return, const TGetOperationStatusReq& req); void send_GetOperationStatus(const TGetOperationStatusReq& req); void recv_GetOperationStatus(TGetOperationStatusResp& _return); @@ -2212,6 +2434,8 @@ class TCLIServiceProcessor : public ::apache::thrift::TDispatchProcessor { void process_GetTableTypes(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_GetColumns(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_GetFunctions(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_GetPrimaryKeys(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_GetCrossReference(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_GetOperationStatus(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_CancelOperation(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_CloseOperation(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); @@ -2234,6 +2458,8 @@ class TCLIServiceProcessor : public ::apache::thrift::TDispatchProcessor { processMap_["GetTableTypes"] = &TCLIServiceProcessor::process_GetTableTypes; processMap_["GetColumns"] = &TCLIServiceProcessor::process_GetColumns; processMap_["GetFunctions"] = &TCLIServiceProcessor::process_GetFunctions; + processMap_["GetPrimaryKeys"] = &TCLIServiceProcessor::process_GetPrimaryKeys; + processMap_["GetCrossReference"] = &TCLIServiceProcessor::process_GetCrossReference; processMap_["GetOperationStatus"] = &TCLIServiceProcessor::process_GetOperationStatus; processMap_["CancelOperation"] = &TCLIServiceProcessor::process_CancelOperation; processMap_["CloseOperation"] = &TCLIServiceProcessor::process_CloseOperation; @@ -2380,6 +2606,26 @@ class TCLIServiceMultiface : virtual public TCLIServiceIf { return; } + void GetPrimaryKeys(TGetPrimaryKeysResp& _return, const TGetPrimaryKeysReq& req) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->GetPrimaryKeys(_return, req); + } + ifaces_[i]->GetPrimaryKeys(_return, req); + return; + } + + void GetCrossReference(TGetCrossReferenceResp& _return, const TGetCrossReferenceReq& req) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->GetCrossReference(_return, req); + } + ifaces_[i]->GetCrossReference(_return, req); + return; + } + void GetOperationStatus(TGetOperationStatusResp& _return, const TGetOperationStatusReq& req) { size_t sz = ifaces_.size(); size_t i = 0; @@ -2523,6 +2769,12 @@ class TCLIServiceConcurrentClient : virtual public TCLIServiceIf { void GetFunctions(TGetFunctionsResp& _return, const TGetFunctionsReq& req); int32_t send_GetFunctions(const TGetFunctionsReq& req); void recv_GetFunctions(TGetFunctionsResp& _return, const int32_t seqid); + void GetPrimaryKeys(TGetPrimaryKeysResp& _return, const TGetPrimaryKeysReq& req); + int32_t send_GetPrimaryKeys(const TGetPrimaryKeysReq& req); + void recv_GetPrimaryKeys(TGetPrimaryKeysResp& _return, const int32_t seqid); + void GetCrossReference(TGetCrossReferenceResp& _return, const TGetCrossReferenceReq& req); + int32_t send_GetCrossReference(const TGetCrossReferenceReq& req); + void recv_GetCrossReference(TGetCrossReferenceResp& _return, const int32_t seqid); void GetOperationStatus(TGetOperationStatusResp& _return, const TGetOperationStatusReq& req); int32_t send_GetOperationStatus(const TGetOperationStatusReq& req); void recv_GetOperationStatus(TGetOperationStatusResp& _return, const int32_t seqid); diff --git a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp index 66ed6a7..5d7caf9 100644 --- a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp +++ b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp @@ -77,6 +77,16 @@ class TCLIServiceHandler : virtual public TCLIServiceIf { printf("GetFunctions\n"); } + void GetPrimaryKeys(TGetPrimaryKeysResp& _return, const TGetPrimaryKeysReq& req) { + // Your implementation goes here + printf("GetPrimaryKeys\n"); + } + + void GetCrossReference(TGetCrossReferenceResp& _return, const TGetCrossReferenceReq& req) { + // Your implementation goes here + printf("GetCrossReference\n"); + } + void GetOperationStatus(TGetOperationStatusResp& _return, const TGetOperationStatusReq& req) { // Your implementation goes here printf("GetOperationStatus\n"); diff --git a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp index 3a27a60..afbc7ed 100644 --- a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp +++ b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.cpp @@ -7498,6 +7498,604 @@ void TGetFunctionsResp::printTo(std::ostream& out) const { } +TGetPrimaryKeysReq::~TGetPrimaryKeysReq() throw() { +} + + +void TGetPrimaryKeysReq::__set_sessionHandle(const TSessionHandle& val) { + this->sessionHandle = val; +} + +void TGetPrimaryKeysReq::__set_catalogName(const TIdentifier& val) { + this->catalogName = val; +__isset.catalogName = true; +} + +void TGetPrimaryKeysReq::__set_schemaName(const TIdentifier& val) { + this->schemaName = val; +__isset.schemaName = true; +} + +void TGetPrimaryKeysReq::__set_tableName(const TIdentifier& val) { + this->tableName = val; +__isset.tableName = true; +} + +uint32_t TGetPrimaryKeysReq::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_sessionHandle = false; + + 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->sessionHandle.read(iprot); + isset_sessionHandle = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->catalogName); + this->__isset.catalogName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->schemaName); + this->__isset.schemaName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->tableName); + this->__isset.tableName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_sessionHandle) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TGetPrimaryKeysReq::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TGetPrimaryKeysReq"); + + xfer += oprot->writeFieldBegin("sessionHandle", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->sessionHandle.write(oprot); + xfer += oprot->writeFieldEnd(); + + if (this->__isset.catalogName) { + xfer += oprot->writeFieldBegin("catalogName", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->catalogName); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.schemaName) { + xfer += oprot->writeFieldBegin("schemaName", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->schemaName); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.tableName) { + xfer += oprot->writeFieldBegin("tableName", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString(this->tableName); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TGetPrimaryKeysReq &a, TGetPrimaryKeysReq &b) { + using ::std::swap; + swap(a.sessionHandle, b.sessionHandle); + swap(a.catalogName, b.catalogName); + swap(a.schemaName, b.schemaName); + swap(a.tableName, b.tableName); + swap(a.__isset, b.__isset); +} + +TGetPrimaryKeysReq::TGetPrimaryKeysReq(const TGetPrimaryKeysReq& other260) { + sessionHandle = other260.sessionHandle; + catalogName = other260.catalogName; + schemaName = other260.schemaName; + tableName = other260.tableName; + __isset = other260.__isset; +} +TGetPrimaryKeysReq& TGetPrimaryKeysReq::operator=(const TGetPrimaryKeysReq& other261) { + sessionHandle = other261.sessionHandle; + catalogName = other261.catalogName; + schemaName = other261.schemaName; + tableName = other261.tableName; + __isset = other261.__isset; + return *this; +} +void TGetPrimaryKeysReq::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "TGetPrimaryKeysReq("; + out << "sessionHandle=" << to_string(sessionHandle); + out << ", " << "catalogName="; (__isset.catalogName ? (out << to_string(catalogName)) : (out << "")); + out << ", " << "schemaName="; (__isset.schemaName ? (out << to_string(schemaName)) : (out << "")); + out << ", " << "tableName="; (__isset.tableName ? (out << to_string(tableName)) : (out << "")); + out << ")"; +} + + +TGetPrimaryKeysResp::~TGetPrimaryKeysResp() throw() { +} + + +void TGetPrimaryKeysResp::__set_status(const TStatus& val) { + this->status = val; +} + +void TGetPrimaryKeysResp::__set_operationHandle(const TOperationHandle& val) { + this->operationHandle = val; +__isset.operationHandle = true; +} + +uint32_t TGetPrimaryKeysResp::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_status = false; + + 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->status.read(iprot); + isset_status = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->operationHandle.read(iprot); + this->__isset.operationHandle = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_status) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TGetPrimaryKeysResp::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TGetPrimaryKeysResp"); + + xfer += oprot->writeFieldBegin("status", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->status.write(oprot); + xfer += oprot->writeFieldEnd(); + + if (this->__isset.operationHandle) { + xfer += oprot->writeFieldBegin("operationHandle", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->operationHandle.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TGetPrimaryKeysResp &a, TGetPrimaryKeysResp &b) { + using ::std::swap; + swap(a.status, b.status); + swap(a.operationHandle, b.operationHandle); + swap(a.__isset, b.__isset); +} + +TGetPrimaryKeysResp::TGetPrimaryKeysResp(const TGetPrimaryKeysResp& other262) { + status = other262.status; + operationHandle = other262.operationHandle; + __isset = other262.__isset; +} +TGetPrimaryKeysResp& TGetPrimaryKeysResp::operator=(const TGetPrimaryKeysResp& other263) { + status = other263.status; + operationHandle = other263.operationHandle; + __isset = other263.__isset; + return *this; +} +void TGetPrimaryKeysResp::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "TGetPrimaryKeysResp("; + out << "status=" << to_string(status); + out << ", " << "operationHandle="; (__isset.operationHandle ? (out << to_string(operationHandle)) : (out << "")); + out << ")"; +} + + +TGetCrossReferenceReq::~TGetCrossReferenceReq() throw() { +} + + +void TGetCrossReferenceReq::__set_sessionHandle(const TSessionHandle& val) { + this->sessionHandle = val; +} + +void TGetCrossReferenceReq::__set_parentCatalogName(const TIdentifier& val) { + this->parentCatalogName = val; +__isset.parentCatalogName = true; +} + +void TGetCrossReferenceReq::__set_parentSchemaName(const TIdentifier& val) { + this->parentSchemaName = val; +__isset.parentSchemaName = true; +} + +void TGetCrossReferenceReq::__set_parentTableName(const TIdentifier& val) { + this->parentTableName = val; +__isset.parentTableName = true; +} + +void TGetCrossReferenceReq::__set_foreignCatalogName(const TIdentifier& val) { + this->foreignCatalogName = val; +__isset.foreignCatalogName = true; +} + +void TGetCrossReferenceReq::__set_foreignSchemaName(const TIdentifier& val) { + this->foreignSchemaName = val; +__isset.foreignSchemaName = true; +} + +void TGetCrossReferenceReq::__set_foreignTableName(const TIdentifier& val) { + this->foreignTableName = val; +__isset.foreignTableName = true; +} + +uint32_t TGetCrossReferenceReq::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_sessionHandle = false; + + 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->sessionHandle.read(iprot); + isset_sessionHandle = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->parentCatalogName); + this->__isset.parentCatalogName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->parentSchemaName); + this->__isset.parentSchemaName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->parentTableName); + this->__isset.parentTableName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->foreignCatalogName); + this->__isset.foreignCatalogName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->foreignSchemaName); + this->__isset.foreignSchemaName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 7: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->foreignTableName); + this->__isset.foreignTableName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_sessionHandle) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TGetCrossReferenceReq::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TGetCrossReferenceReq"); + + xfer += oprot->writeFieldBegin("sessionHandle", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->sessionHandle.write(oprot); + xfer += oprot->writeFieldEnd(); + + if (this->__isset.parentCatalogName) { + xfer += oprot->writeFieldBegin("parentCatalogName", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->parentCatalogName); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.parentSchemaName) { + xfer += oprot->writeFieldBegin("parentSchemaName", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->parentSchemaName); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.parentTableName) { + xfer += oprot->writeFieldBegin("parentTableName", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString(this->parentTableName); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.foreignCatalogName) { + xfer += oprot->writeFieldBegin("foreignCatalogName", ::apache::thrift::protocol::T_STRING, 5); + xfer += oprot->writeString(this->foreignCatalogName); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.foreignSchemaName) { + xfer += oprot->writeFieldBegin("foreignSchemaName", ::apache::thrift::protocol::T_STRING, 6); + xfer += oprot->writeString(this->foreignSchemaName); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.foreignTableName) { + xfer += oprot->writeFieldBegin("foreignTableName", ::apache::thrift::protocol::T_STRING, 7); + xfer += oprot->writeString(this->foreignTableName); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TGetCrossReferenceReq &a, TGetCrossReferenceReq &b) { + using ::std::swap; + swap(a.sessionHandle, b.sessionHandle); + swap(a.parentCatalogName, b.parentCatalogName); + swap(a.parentSchemaName, b.parentSchemaName); + swap(a.parentTableName, b.parentTableName); + swap(a.foreignCatalogName, b.foreignCatalogName); + swap(a.foreignSchemaName, b.foreignSchemaName); + swap(a.foreignTableName, b.foreignTableName); + swap(a.__isset, b.__isset); +} + +TGetCrossReferenceReq::TGetCrossReferenceReq(const TGetCrossReferenceReq& other264) { + sessionHandle = other264.sessionHandle; + parentCatalogName = other264.parentCatalogName; + parentSchemaName = other264.parentSchemaName; + parentTableName = other264.parentTableName; + foreignCatalogName = other264.foreignCatalogName; + foreignSchemaName = other264.foreignSchemaName; + foreignTableName = other264.foreignTableName; + __isset = other264.__isset; +} +TGetCrossReferenceReq& TGetCrossReferenceReq::operator=(const TGetCrossReferenceReq& other265) { + sessionHandle = other265.sessionHandle; + parentCatalogName = other265.parentCatalogName; + parentSchemaName = other265.parentSchemaName; + parentTableName = other265.parentTableName; + foreignCatalogName = other265.foreignCatalogName; + foreignSchemaName = other265.foreignSchemaName; + foreignTableName = other265.foreignTableName; + __isset = other265.__isset; + return *this; +} +void TGetCrossReferenceReq::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "TGetCrossReferenceReq("; + out << "sessionHandle=" << to_string(sessionHandle); + out << ", " << "parentCatalogName="; (__isset.parentCatalogName ? (out << to_string(parentCatalogName)) : (out << "")); + out << ", " << "parentSchemaName="; (__isset.parentSchemaName ? (out << to_string(parentSchemaName)) : (out << "")); + out << ", " << "parentTableName="; (__isset.parentTableName ? (out << to_string(parentTableName)) : (out << "")); + out << ", " << "foreignCatalogName="; (__isset.foreignCatalogName ? (out << to_string(foreignCatalogName)) : (out << "")); + out << ", " << "foreignSchemaName="; (__isset.foreignSchemaName ? (out << to_string(foreignSchemaName)) : (out << "")); + out << ", " << "foreignTableName="; (__isset.foreignTableName ? (out << to_string(foreignTableName)) : (out << "")); + out << ")"; +} + + +TGetCrossReferenceResp::~TGetCrossReferenceResp() throw() { +} + + +void TGetCrossReferenceResp::__set_status(const TStatus& val) { + this->status = val; +} + +void TGetCrossReferenceResp::__set_operationHandle(const TOperationHandle& val) { + this->operationHandle = val; +__isset.operationHandle = true; +} + +uint32_t TGetCrossReferenceResp::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_status = false; + + 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->status.read(iprot); + isset_status = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->operationHandle.read(iprot); + this->__isset.operationHandle = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_status) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TGetCrossReferenceResp::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TGetCrossReferenceResp"); + + xfer += oprot->writeFieldBegin("status", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->status.write(oprot); + xfer += oprot->writeFieldEnd(); + + if (this->__isset.operationHandle) { + xfer += oprot->writeFieldBegin("operationHandle", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->operationHandle.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TGetCrossReferenceResp &a, TGetCrossReferenceResp &b) { + using ::std::swap; + swap(a.status, b.status); + swap(a.operationHandle, b.operationHandle); + swap(a.__isset, b.__isset); +} + +TGetCrossReferenceResp::TGetCrossReferenceResp(const TGetCrossReferenceResp& other266) { + status = other266.status; + operationHandle = other266.operationHandle; + __isset = other266.__isset; +} +TGetCrossReferenceResp& TGetCrossReferenceResp::operator=(const TGetCrossReferenceResp& other267) { + status = other267.status; + operationHandle = other267.operationHandle; + __isset = other267.__isset; + return *this; +} +void TGetCrossReferenceResp::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "TGetCrossReferenceResp("; + out << "status=" << to_string(status); + out << ", " << "operationHandle="; (__isset.operationHandle ? (out << to_string(operationHandle)) : (out << "")); + out << ")"; +} + + TGetOperationStatusReq::~TGetOperationStatusReq() throw() { } @@ -7569,11 +8167,11 @@ void swap(TGetOperationStatusReq &a, TGetOperationStatusReq &b) { swap(a.operationHandle, b.operationHandle); } -TGetOperationStatusReq::TGetOperationStatusReq(const TGetOperationStatusReq& other260) { - operationHandle = other260.operationHandle; +TGetOperationStatusReq::TGetOperationStatusReq(const TGetOperationStatusReq& other268) { + operationHandle = other268.operationHandle; } -TGetOperationStatusReq& TGetOperationStatusReq::operator=(const TGetOperationStatusReq& other261) { - operationHandle = other261.operationHandle; +TGetOperationStatusReq& TGetOperationStatusReq::operator=(const TGetOperationStatusReq& other269) { + operationHandle = other269.operationHandle; return *this; } void TGetOperationStatusReq::printTo(std::ostream& out) const { @@ -7659,9 +8257,9 @@ uint32_t TGetOperationStatusResp::read(::apache::thrift::protocol::TProtocol* ip break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast262; - xfer += iprot->readI32(ecast262); - this->operationState = (TOperationState::type)ecast262; + int32_t ecast270; + xfer += iprot->readI32(ecast270); + this->operationState = (TOperationState::type)ecast270; this->__isset.operationState = true; } else { xfer += iprot->skip(ftype); @@ -7791,27 +8389,27 @@ void swap(TGetOperationStatusResp &a, TGetOperationStatusResp &b) { swap(a.__isset, b.__isset); } -TGetOperationStatusResp::TGetOperationStatusResp(const TGetOperationStatusResp& other263) { - status = other263.status; - operationState = other263.operationState; - sqlState = other263.sqlState; - errorCode = other263.errorCode; - errorMessage = other263.errorMessage; - taskStatus = other263.taskStatus; - operationStarted = other263.operationStarted; - operationCompleted = other263.operationCompleted; - __isset = other263.__isset; -} -TGetOperationStatusResp& TGetOperationStatusResp::operator=(const TGetOperationStatusResp& other264) { - status = other264.status; - operationState = other264.operationState; - sqlState = other264.sqlState; - errorCode = other264.errorCode; - errorMessage = other264.errorMessage; - taskStatus = other264.taskStatus; - operationStarted = other264.operationStarted; - operationCompleted = other264.operationCompleted; - __isset = other264.__isset; +TGetOperationStatusResp::TGetOperationStatusResp(const TGetOperationStatusResp& other271) { + status = other271.status; + operationState = other271.operationState; + sqlState = other271.sqlState; + errorCode = other271.errorCode; + errorMessage = other271.errorMessage; + taskStatus = other271.taskStatus; + operationStarted = other271.operationStarted; + operationCompleted = other271.operationCompleted; + __isset = other271.__isset; +} +TGetOperationStatusResp& TGetOperationStatusResp::operator=(const TGetOperationStatusResp& other272) { + status = other272.status; + operationState = other272.operationState; + sqlState = other272.sqlState; + errorCode = other272.errorCode; + errorMessage = other272.errorMessage; + taskStatus = other272.taskStatus; + operationStarted = other272.operationStarted; + operationCompleted = other272.operationCompleted; + __isset = other272.__isset; return *this; } void TGetOperationStatusResp::printTo(std::ostream& out) const { @@ -7900,11 +8498,11 @@ void swap(TCancelOperationReq &a, TCancelOperationReq &b) { swap(a.operationHandle, b.operationHandle); } -TCancelOperationReq::TCancelOperationReq(const TCancelOperationReq& other265) { - operationHandle = other265.operationHandle; +TCancelOperationReq::TCancelOperationReq(const TCancelOperationReq& other273) { + operationHandle = other273.operationHandle; } -TCancelOperationReq& TCancelOperationReq::operator=(const TCancelOperationReq& other266) { - operationHandle = other266.operationHandle; +TCancelOperationReq& TCancelOperationReq::operator=(const TCancelOperationReq& other274) { + operationHandle = other274.operationHandle; return *this; } void TCancelOperationReq::printTo(std::ostream& out) const { @@ -7986,11 +8584,11 @@ void swap(TCancelOperationResp &a, TCancelOperationResp &b) { swap(a.status, b.status); } -TCancelOperationResp::TCancelOperationResp(const TCancelOperationResp& other267) { - status = other267.status; +TCancelOperationResp::TCancelOperationResp(const TCancelOperationResp& other275) { + status = other275.status; } -TCancelOperationResp& TCancelOperationResp::operator=(const TCancelOperationResp& other268) { - status = other268.status; +TCancelOperationResp& TCancelOperationResp::operator=(const TCancelOperationResp& other276) { + status = other276.status; return *this; } void TCancelOperationResp::printTo(std::ostream& out) const { @@ -8072,11 +8670,11 @@ void swap(TCloseOperationReq &a, TCloseOperationReq &b) { swap(a.operationHandle, b.operationHandle); } -TCloseOperationReq::TCloseOperationReq(const TCloseOperationReq& other269) { - operationHandle = other269.operationHandle; +TCloseOperationReq::TCloseOperationReq(const TCloseOperationReq& other277) { + operationHandle = other277.operationHandle; } -TCloseOperationReq& TCloseOperationReq::operator=(const TCloseOperationReq& other270) { - operationHandle = other270.operationHandle; +TCloseOperationReq& TCloseOperationReq::operator=(const TCloseOperationReq& other278) { + operationHandle = other278.operationHandle; return *this; } void TCloseOperationReq::printTo(std::ostream& out) const { @@ -8158,11 +8756,11 @@ void swap(TCloseOperationResp &a, TCloseOperationResp &b) { swap(a.status, b.status); } -TCloseOperationResp::TCloseOperationResp(const TCloseOperationResp& other271) { - status = other271.status; +TCloseOperationResp::TCloseOperationResp(const TCloseOperationResp& other279) { + status = other279.status; } -TCloseOperationResp& TCloseOperationResp::operator=(const TCloseOperationResp& other272) { - status = other272.status; +TCloseOperationResp& TCloseOperationResp::operator=(const TCloseOperationResp& other280) { + status = other280.status; return *this; } void TCloseOperationResp::printTo(std::ostream& out) const { @@ -8244,11 +8842,11 @@ void swap(TGetResultSetMetadataReq &a, TGetResultSetMetadataReq &b) { swap(a.operationHandle, b.operationHandle); } -TGetResultSetMetadataReq::TGetResultSetMetadataReq(const TGetResultSetMetadataReq& other273) { - operationHandle = other273.operationHandle; +TGetResultSetMetadataReq::TGetResultSetMetadataReq(const TGetResultSetMetadataReq& other281) { + operationHandle = other281.operationHandle; } -TGetResultSetMetadataReq& TGetResultSetMetadataReq::operator=(const TGetResultSetMetadataReq& other274) { - operationHandle = other274.operationHandle; +TGetResultSetMetadataReq& TGetResultSetMetadataReq::operator=(const TGetResultSetMetadataReq& other282) { + operationHandle = other282.operationHandle; return *this; } void TGetResultSetMetadataReq::printTo(std::ostream& out) const { @@ -8350,15 +8948,15 @@ void swap(TGetResultSetMetadataResp &a, TGetResultSetMetadataResp &b) { swap(a.__isset, b.__isset); } -TGetResultSetMetadataResp::TGetResultSetMetadataResp(const TGetResultSetMetadataResp& other275) { - status = other275.status; - schema = other275.schema; - __isset = other275.__isset; +TGetResultSetMetadataResp::TGetResultSetMetadataResp(const TGetResultSetMetadataResp& other283) { + status = other283.status; + schema = other283.schema; + __isset = other283.__isset; } -TGetResultSetMetadataResp& TGetResultSetMetadataResp::operator=(const TGetResultSetMetadataResp& other276) { - status = other276.status; - schema = other276.schema; - __isset = other276.__isset; +TGetResultSetMetadataResp& TGetResultSetMetadataResp::operator=(const TGetResultSetMetadataResp& other284) { + status = other284.status; + schema = other284.schema; + __isset = other284.__isset; return *this; } void TGetResultSetMetadataResp::printTo(std::ostream& out) const { @@ -8425,9 +9023,9 @@ uint32_t TFetchResultsReq::read(::apache::thrift::protocol::TProtocol* iprot) { break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast277; - xfer += iprot->readI32(ecast277); - this->orientation = (TFetchOrientation::type)ecast277; + int32_t ecast285; + xfer += iprot->readI32(ecast285); + this->orientation = (TFetchOrientation::type)ecast285; isset_orientation = true; } else { xfer += iprot->skip(ftype); @@ -8503,19 +9101,19 @@ void swap(TFetchResultsReq &a, TFetchResultsReq &b) { swap(a.__isset, b.__isset); } -TFetchResultsReq::TFetchResultsReq(const TFetchResultsReq& other278) { - operationHandle = other278.operationHandle; - orientation = other278.orientation; - maxRows = other278.maxRows; - fetchType = other278.fetchType; - __isset = other278.__isset; -} -TFetchResultsReq& TFetchResultsReq::operator=(const TFetchResultsReq& other279) { - operationHandle = other279.operationHandle; - orientation = other279.orientation; - maxRows = other279.maxRows; - fetchType = other279.fetchType; - __isset = other279.__isset; +TFetchResultsReq::TFetchResultsReq(const TFetchResultsReq& other286) { + operationHandle = other286.operationHandle; + orientation = other286.orientation; + maxRows = other286.maxRows; + fetchType = other286.fetchType; + __isset = other286.__isset; +} +TFetchResultsReq& TFetchResultsReq::operator=(const TFetchResultsReq& other287) { + operationHandle = other287.operationHandle; + orientation = other287.orientation; + maxRows = other287.maxRows; + fetchType = other287.fetchType; + __isset = other287.__isset; return *this; } void TFetchResultsReq::printTo(std::ostream& out) const { @@ -8639,17 +9237,17 @@ void swap(TFetchResultsResp &a, TFetchResultsResp &b) { swap(a.__isset, b.__isset); } -TFetchResultsResp::TFetchResultsResp(const TFetchResultsResp& other280) { - status = other280.status; - hasMoreRows = other280.hasMoreRows; - results = other280.results; - __isset = other280.__isset; -} -TFetchResultsResp& TFetchResultsResp::operator=(const TFetchResultsResp& other281) { - status = other281.status; - hasMoreRows = other281.hasMoreRows; - results = other281.results; - __isset = other281.__isset; +TFetchResultsResp::TFetchResultsResp(const TFetchResultsResp& other288) { + status = other288.status; + hasMoreRows = other288.hasMoreRows; + results = other288.results; + __isset = other288.__isset; +} +TFetchResultsResp& TFetchResultsResp::operator=(const TFetchResultsResp& other289) { + status = other289.status; + hasMoreRows = other289.hasMoreRows; + results = other289.results; + __isset = other289.__isset; return *this; } void TFetchResultsResp::printTo(std::ostream& out) const { @@ -8773,15 +9371,15 @@ void swap(TGetDelegationTokenReq &a, TGetDelegationTokenReq &b) { swap(a.renewer, b.renewer); } -TGetDelegationTokenReq::TGetDelegationTokenReq(const TGetDelegationTokenReq& other282) { - sessionHandle = other282.sessionHandle; - owner = other282.owner; - renewer = other282.renewer; +TGetDelegationTokenReq::TGetDelegationTokenReq(const TGetDelegationTokenReq& other290) { + sessionHandle = other290.sessionHandle; + owner = other290.owner; + renewer = other290.renewer; } -TGetDelegationTokenReq& TGetDelegationTokenReq::operator=(const TGetDelegationTokenReq& other283) { - sessionHandle = other283.sessionHandle; - owner = other283.owner; - renewer = other283.renewer; +TGetDelegationTokenReq& TGetDelegationTokenReq::operator=(const TGetDelegationTokenReq& other291) { + sessionHandle = other291.sessionHandle; + owner = other291.owner; + renewer = other291.renewer; return *this; } void TGetDelegationTokenReq::printTo(std::ostream& out) const { @@ -8885,15 +9483,15 @@ void swap(TGetDelegationTokenResp &a, TGetDelegationTokenResp &b) { swap(a.__isset, b.__isset); } -TGetDelegationTokenResp::TGetDelegationTokenResp(const TGetDelegationTokenResp& other284) { - status = other284.status; - delegationToken = other284.delegationToken; - __isset = other284.__isset; +TGetDelegationTokenResp::TGetDelegationTokenResp(const TGetDelegationTokenResp& other292) { + status = other292.status; + delegationToken = other292.delegationToken; + __isset = other292.__isset; } -TGetDelegationTokenResp& TGetDelegationTokenResp::operator=(const TGetDelegationTokenResp& other285) { - status = other285.status; - delegationToken = other285.delegationToken; - __isset = other285.__isset; +TGetDelegationTokenResp& TGetDelegationTokenResp::operator=(const TGetDelegationTokenResp& other293) { + status = other293.status; + delegationToken = other293.delegationToken; + __isset = other293.__isset; return *this; } void TGetDelegationTokenResp::printTo(std::ostream& out) const { @@ -8996,13 +9594,13 @@ void swap(TCancelDelegationTokenReq &a, TCancelDelegationTokenReq &b) { swap(a.delegationToken, b.delegationToken); } -TCancelDelegationTokenReq::TCancelDelegationTokenReq(const TCancelDelegationTokenReq& other286) { - sessionHandle = other286.sessionHandle; - delegationToken = other286.delegationToken; +TCancelDelegationTokenReq::TCancelDelegationTokenReq(const TCancelDelegationTokenReq& other294) { + sessionHandle = other294.sessionHandle; + delegationToken = other294.delegationToken; } -TCancelDelegationTokenReq& TCancelDelegationTokenReq::operator=(const TCancelDelegationTokenReq& other287) { - sessionHandle = other287.sessionHandle; - delegationToken = other287.delegationToken; +TCancelDelegationTokenReq& TCancelDelegationTokenReq::operator=(const TCancelDelegationTokenReq& other295) { + sessionHandle = other295.sessionHandle; + delegationToken = other295.delegationToken; return *this; } void TCancelDelegationTokenReq::printTo(std::ostream& out) const { @@ -9085,11 +9683,11 @@ void swap(TCancelDelegationTokenResp &a, TCancelDelegationTokenResp &b) { swap(a.status, b.status); } -TCancelDelegationTokenResp::TCancelDelegationTokenResp(const TCancelDelegationTokenResp& other288) { - status = other288.status; +TCancelDelegationTokenResp::TCancelDelegationTokenResp(const TCancelDelegationTokenResp& other296) { + status = other296.status; } -TCancelDelegationTokenResp& TCancelDelegationTokenResp::operator=(const TCancelDelegationTokenResp& other289) { - status = other289.status; +TCancelDelegationTokenResp& TCancelDelegationTokenResp::operator=(const TCancelDelegationTokenResp& other297) { + status = other297.status; return *this; } void TCancelDelegationTokenResp::printTo(std::ostream& out) const { @@ -9191,13 +9789,13 @@ void swap(TRenewDelegationTokenReq &a, TRenewDelegationTokenReq &b) { swap(a.delegationToken, b.delegationToken); } -TRenewDelegationTokenReq::TRenewDelegationTokenReq(const TRenewDelegationTokenReq& other290) { - sessionHandle = other290.sessionHandle; - delegationToken = other290.delegationToken; +TRenewDelegationTokenReq::TRenewDelegationTokenReq(const TRenewDelegationTokenReq& other298) { + sessionHandle = other298.sessionHandle; + delegationToken = other298.delegationToken; } -TRenewDelegationTokenReq& TRenewDelegationTokenReq::operator=(const TRenewDelegationTokenReq& other291) { - sessionHandle = other291.sessionHandle; - delegationToken = other291.delegationToken; +TRenewDelegationTokenReq& TRenewDelegationTokenReq::operator=(const TRenewDelegationTokenReq& other299) { + sessionHandle = other299.sessionHandle; + delegationToken = other299.delegationToken; return *this; } void TRenewDelegationTokenReq::printTo(std::ostream& out) const { @@ -9280,11 +9878,11 @@ void swap(TRenewDelegationTokenResp &a, TRenewDelegationTokenResp &b) { swap(a.status, b.status); } -TRenewDelegationTokenResp::TRenewDelegationTokenResp(const TRenewDelegationTokenResp& other292) { - status = other292.status; +TRenewDelegationTokenResp::TRenewDelegationTokenResp(const TRenewDelegationTokenResp& other300) { + status = other300.status; } -TRenewDelegationTokenResp& TRenewDelegationTokenResp::operator=(const TRenewDelegationTokenResp& other293) { - status = other293.status; +TRenewDelegationTokenResp& TRenewDelegationTokenResp::operator=(const TRenewDelegationTokenResp& other301) { + status = other301.status; return *this; } void TRenewDelegationTokenResp::printTo(std::ostream& out) const { diff --git a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h index 7f1d9dd..fcc5e3e 100644 --- a/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h +++ b/service-rpc/src/gen/thrift/gen-cpp/TCLIService_types.h @@ -297,6 +297,14 @@ class TGetFunctionsReq; class TGetFunctionsResp; +class TGetPrimaryKeysReq; + +class TGetPrimaryKeysResp; + +class TGetCrossReferenceReq; + +class TGetCrossReferenceResp; + class TGetOperationStatusReq; class TGetOperationStatusResp; @@ -3367,6 +3375,274 @@ inline std::ostream& operator<<(std::ostream& out, const TGetFunctionsResp& obj) return out; } +typedef struct _TGetPrimaryKeysReq__isset { + _TGetPrimaryKeysReq__isset() : catalogName(false), schemaName(false), tableName(false) {} + bool catalogName :1; + bool schemaName :1; + bool tableName :1; +} _TGetPrimaryKeysReq__isset; + +class TGetPrimaryKeysReq { + public: + + TGetPrimaryKeysReq(const TGetPrimaryKeysReq&); + TGetPrimaryKeysReq& operator=(const TGetPrimaryKeysReq&); + TGetPrimaryKeysReq() : catalogName(), schemaName(), tableName() { + } + + virtual ~TGetPrimaryKeysReq() throw(); + TSessionHandle sessionHandle; + TIdentifier catalogName; + TIdentifier schemaName; + TIdentifier tableName; + + _TGetPrimaryKeysReq__isset __isset; + + void __set_sessionHandle(const TSessionHandle& val); + + void __set_catalogName(const TIdentifier& val); + + void __set_schemaName(const TIdentifier& val); + + void __set_tableName(const TIdentifier& val); + + bool operator == (const TGetPrimaryKeysReq & rhs) const + { + if (!(sessionHandle == rhs.sessionHandle)) + return false; + if (__isset.catalogName != rhs.__isset.catalogName) + return false; + else if (__isset.catalogName && !(catalogName == rhs.catalogName)) + return false; + if (__isset.schemaName != rhs.__isset.schemaName) + return false; + else if (__isset.schemaName && !(schemaName == rhs.schemaName)) + return false; + if (__isset.tableName != rhs.__isset.tableName) + return false; + else if (__isset.tableName && !(tableName == rhs.tableName)) + return false; + return true; + } + bool operator != (const TGetPrimaryKeysReq &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TGetPrimaryKeysReq & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; +}; + +void swap(TGetPrimaryKeysReq &a, TGetPrimaryKeysReq &b); + +inline std::ostream& operator<<(std::ostream& out, const TGetPrimaryKeysReq& obj) +{ + obj.printTo(out); + return out; +} + +typedef struct _TGetPrimaryKeysResp__isset { + _TGetPrimaryKeysResp__isset() : operationHandle(false) {} + bool operationHandle :1; +} _TGetPrimaryKeysResp__isset; + +class TGetPrimaryKeysResp { + public: + + TGetPrimaryKeysResp(const TGetPrimaryKeysResp&); + TGetPrimaryKeysResp& operator=(const TGetPrimaryKeysResp&); + TGetPrimaryKeysResp() { + } + + virtual ~TGetPrimaryKeysResp() throw(); + TStatus status; + TOperationHandle operationHandle; + + _TGetPrimaryKeysResp__isset __isset; + + void __set_status(const TStatus& val); + + void __set_operationHandle(const TOperationHandle& val); + + bool operator == (const TGetPrimaryKeysResp & rhs) const + { + if (!(status == rhs.status)) + return false; + if (__isset.operationHandle != rhs.__isset.operationHandle) + return false; + else if (__isset.operationHandle && !(operationHandle == rhs.operationHandle)) + return false; + return true; + } + bool operator != (const TGetPrimaryKeysResp &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TGetPrimaryKeysResp & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; +}; + +void swap(TGetPrimaryKeysResp &a, TGetPrimaryKeysResp &b); + +inline std::ostream& operator<<(std::ostream& out, const TGetPrimaryKeysResp& obj) +{ + obj.printTo(out); + return out; +} + +typedef struct _TGetCrossReferenceReq__isset { + _TGetCrossReferenceReq__isset() : parentCatalogName(false), parentSchemaName(false), parentTableName(false), foreignCatalogName(false), foreignSchemaName(false), foreignTableName(false) {} + bool parentCatalogName :1; + bool parentSchemaName :1; + bool parentTableName :1; + bool foreignCatalogName :1; + bool foreignSchemaName :1; + bool foreignTableName :1; +} _TGetCrossReferenceReq__isset; + +class TGetCrossReferenceReq { + public: + + TGetCrossReferenceReq(const TGetCrossReferenceReq&); + TGetCrossReferenceReq& operator=(const TGetCrossReferenceReq&); + TGetCrossReferenceReq() : parentCatalogName(), parentSchemaName(), parentTableName(), foreignCatalogName(), foreignSchemaName(), foreignTableName() { + } + + virtual ~TGetCrossReferenceReq() throw(); + TSessionHandle sessionHandle; + TIdentifier parentCatalogName; + TIdentifier parentSchemaName; + TIdentifier parentTableName; + TIdentifier foreignCatalogName; + TIdentifier foreignSchemaName; + TIdentifier foreignTableName; + + _TGetCrossReferenceReq__isset __isset; + + void __set_sessionHandle(const TSessionHandle& val); + + void __set_parentCatalogName(const TIdentifier& val); + + void __set_parentSchemaName(const TIdentifier& val); + + void __set_parentTableName(const TIdentifier& val); + + void __set_foreignCatalogName(const TIdentifier& val); + + void __set_foreignSchemaName(const TIdentifier& val); + + void __set_foreignTableName(const TIdentifier& val); + + bool operator == (const TGetCrossReferenceReq & rhs) const + { + if (!(sessionHandle == rhs.sessionHandle)) + return false; + if (__isset.parentCatalogName != rhs.__isset.parentCatalogName) + return false; + else if (__isset.parentCatalogName && !(parentCatalogName == rhs.parentCatalogName)) + return false; + if (__isset.parentSchemaName != rhs.__isset.parentSchemaName) + return false; + else if (__isset.parentSchemaName && !(parentSchemaName == rhs.parentSchemaName)) + return false; + if (__isset.parentTableName != rhs.__isset.parentTableName) + return false; + else if (__isset.parentTableName && !(parentTableName == rhs.parentTableName)) + return false; + if (__isset.foreignCatalogName != rhs.__isset.foreignCatalogName) + return false; + else if (__isset.foreignCatalogName && !(foreignCatalogName == rhs.foreignCatalogName)) + return false; + if (__isset.foreignSchemaName != rhs.__isset.foreignSchemaName) + return false; + else if (__isset.foreignSchemaName && !(foreignSchemaName == rhs.foreignSchemaName)) + return false; + if (__isset.foreignTableName != rhs.__isset.foreignTableName) + return false; + else if (__isset.foreignTableName && !(foreignTableName == rhs.foreignTableName)) + return false; + return true; + } + bool operator != (const TGetCrossReferenceReq &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TGetCrossReferenceReq & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; +}; + +void swap(TGetCrossReferenceReq &a, TGetCrossReferenceReq &b); + +inline std::ostream& operator<<(std::ostream& out, const TGetCrossReferenceReq& obj) +{ + obj.printTo(out); + return out; +} + +typedef struct _TGetCrossReferenceResp__isset { + _TGetCrossReferenceResp__isset() : operationHandle(false) {} + bool operationHandle :1; +} _TGetCrossReferenceResp__isset; + +class TGetCrossReferenceResp { + public: + + TGetCrossReferenceResp(const TGetCrossReferenceResp&); + TGetCrossReferenceResp& operator=(const TGetCrossReferenceResp&); + TGetCrossReferenceResp() { + } + + virtual ~TGetCrossReferenceResp() throw(); + TStatus status; + TOperationHandle operationHandle; + + _TGetCrossReferenceResp__isset __isset; + + void __set_status(const TStatus& val); + + void __set_operationHandle(const TOperationHandle& val); + + bool operator == (const TGetCrossReferenceResp & rhs) const + { + if (!(status == rhs.status)) + return false; + if (__isset.operationHandle != rhs.__isset.operationHandle) + return false; + else if (__isset.operationHandle && !(operationHandle == rhs.operationHandle)) + return false; + return true; + } + bool operator != (const TGetCrossReferenceResp &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TGetCrossReferenceResp & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; +}; + +void swap(TGetCrossReferenceResp &a, TGetCrossReferenceResp &b); + +inline std::ostream& operator<<(std::ostream& out, const TGetCrossReferenceResp& obj) +{ + obj.printTo(out); + return out; +} + class TGetOperationStatusReq { public: diff --git a/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TCLIService.java b/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TCLIService.java index c684f89..6dba051 100644 --- a/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TCLIService.java +++ b/service-rpc/src/gen/thrift/gen-javabean/org/apache/hive/service/rpc/thrift/TCLIService.java @@ -61,6 +61,10 @@ public TGetFunctionsResp GetFunctions(TGetFunctionsReq req) throws org.apache.thrift.TException; + public TGetPrimaryKeysResp GetPrimaryKeys(TGetPrimaryKeysReq req) throws org.apache.thrift.TException; + + public TGetCrossReferenceResp GetCrossReference(TGetCrossReferenceReq req) throws org.apache.thrift.TException; + public TGetOperationStatusResp GetOperationStatus(TGetOperationStatusReq req) throws org.apache.thrift.TException; public TCancelOperationResp CancelOperation(TCancelOperationReq req) throws org.apache.thrift.TException; @@ -103,6 +107,10 @@ public void GetFunctions(TGetFunctionsReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void GetPrimaryKeys(TGetPrimaryKeysReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void GetCrossReference(TGetCrossReferenceReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void GetOperationStatus(TGetOperationStatusReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void CancelOperation(TCancelOperationReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -394,6 +402,52 @@ public TGetFunctionsResp recv_GetFunctions() throws org.apache.thrift.TException throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "GetFunctions failed: unknown result"); } + public TGetPrimaryKeysResp GetPrimaryKeys(TGetPrimaryKeysReq req) throws org.apache.thrift.TException + { + send_GetPrimaryKeys(req); + return recv_GetPrimaryKeys(); + } + + public void send_GetPrimaryKeys(TGetPrimaryKeysReq req) throws org.apache.thrift.TException + { + GetPrimaryKeys_args args = new GetPrimaryKeys_args(); + args.setReq(req); + sendBase("GetPrimaryKeys", args); + } + + public TGetPrimaryKeysResp recv_GetPrimaryKeys() throws org.apache.thrift.TException + { + GetPrimaryKeys_result result = new GetPrimaryKeys_result(); + receiveBase(result, "GetPrimaryKeys"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "GetPrimaryKeys failed: unknown result"); + } + + public TGetCrossReferenceResp GetCrossReference(TGetCrossReferenceReq req) throws org.apache.thrift.TException + { + send_GetCrossReference(req); + return recv_GetCrossReference(); + } + + public void send_GetCrossReference(TGetCrossReferenceReq req) throws org.apache.thrift.TException + { + GetCrossReference_args args = new GetCrossReference_args(); + args.setReq(req); + sendBase("GetCrossReference", args); + } + + public TGetCrossReferenceResp recv_GetCrossReference() throws org.apache.thrift.TException + { + GetCrossReference_result result = new GetCrossReference_result(); + receiveBase(result, "GetCrossReference"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "GetCrossReference failed: unknown result"); + } + public TGetOperationStatusResp GetOperationStatus(TGetOperationStatusReq req) throws org.apache.thrift.TException { send_GetOperationStatus(req); @@ -948,6 +1002,70 @@ public TGetFunctionsResp getResult() throws org.apache.thrift.TException { } } + public void GetPrimaryKeys(TGetPrimaryKeysReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + GetPrimaryKeys_call method_call = new GetPrimaryKeys_call(req, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class GetPrimaryKeys_call extends org.apache.thrift.async.TAsyncMethodCall { + private TGetPrimaryKeysReq req; + public GetPrimaryKeys_call(TGetPrimaryKeysReq req, 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.req = req; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("GetPrimaryKeys", org.apache.thrift.protocol.TMessageType.CALL, 0)); + GetPrimaryKeys_args args = new GetPrimaryKeys_args(); + args.setReq(req); + args.write(prot); + prot.writeMessageEnd(); + } + + public TGetPrimaryKeysResp getResult() throws 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_GetPrimaryKeys(); + } + } + + public void GetCrossReference(TGetCrossReferenceReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + GetCrossReference_call method_call = new GetCrossReference_call(req, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class GetCrossReference_call extends org.apache.thrift.async.TAsyncMethodCall { + private TGetCrossReferenceReq req; + public GetCrossReference_call(TGetCrossReferenceReq req, 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.req = req; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("GetCrossReference", org.apache.thrift.protocol.TMessageType.CALL, 0)); + GetCrossReference_args args = new GetCrossReference_args(); + args.setReq(req); + args.write(prot); + prot.writeMessageEnd(); + } + + public TGetCrossReferenceResp getResult() throws 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_GetCrossReference(); + } + } + public void GetOperationStatus(TGetOperationStatusReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); GetOperationStatus_call method_call = new GetOperationStatus_call(req, resultHandler, this, ___protocolFactory, ___transport); @@ -1228,6 +1346,8 @@ protected Processor(I iface, Map extends org.apache.thrift.ProcessFunction { + public GetPrimaryKeys() { + super("GetPrimaryKeys"); + } + + public GetPrimaryKeys_args getEmptyArgsInstance() { + return new GetPrimaryKeys_args(); + } + + protected boolean isOneway() { + return false; + } + + public GetPrimaryKeys_result getResult(I iface, GetPrimaryKeys_args args) throws org.apache.thrift.TException { + GetPrimaryKeys_result result = new GetPrimaryKeys_result(); + result.success = iface.GetPrimaryKeys(args.req); + return result; + } + } + + public static class GetCrossReference extends org.apache.thrift.ProcessFunction { + public GetCrossReference() { + super("GetCrossReference"); + } + + public GetCrossReference_args getEmptyArgsInstance() { + return new GetCrossReference_args(); + } + + protected boolean isOneway() { + return false; + } + + public GetCrossReference_result getResult(I iface, GetCrossReference_args args) throws org.apache.thrift.TException { + GetCrossReference_result result = new GetCrossReference_result(); + result.success = iface.GetCrossReference(args.req); + return result; + } + } + public static class GetOperationStatus extends org.apache.thrift.ProcessFunction { public GetOperationStatus() { super("GetOperationStatus"); @@ -1643,6 +1803,8 @@ protected AsyncProcessor(I iface, Map extends org.apache.thrift.AsyncProcessFunction { + public GetPrimaryKeys() { + super("GetPrimaryKeys"); + } + + public GetPrimaryKeys_args getEmptyArgsInstance() { + return new GetPrimaryKeys_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(TGetPrimaryKeysResp o) { + GetPrimaryKeys_result result = new GetPrimaryKeys_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + GetPrimaryKeys_result result = new GetPrimaryKeys_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, GetPrimaryKeys_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.GetPrimaryKeys(args.req,resultHandler); + } + } + + public static class GetCrossReference extends org.apache.thrift.AsyncProcessFunction { + public GetCrossReference() { + super("GetCrossReference"); + } + + public GetCrossReference_args getEmptyArgsInstance() { + return new GetCrossReference_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(TGetCrossReferenceResp o) { + GetCrossReference_result result = new GetCrossReference_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + GetCrossReference_result result = new GetCrossReference_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, GetCrossReference_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.GetCrossReference(args.req,resultHandler); + } + } + public static class GetOperationStatus extends org.apache.thrift.AsyncProcessFunction { public GetOperationStatus() { super("GetOperationStatus"); @@ -10611,6 +10875,1458 @@ public void read(org.apache.thrift.protocol.TProtocol prot, GetFunctions_result } + public static class GetPrimaryKeys_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetPrimaryKeys_args"); + + private static final org.apache.thrift.protocol.TField REQ_FIELD_DESC = new org.apache.thrift.protocol.TField("req", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new GetPrimaryKeys_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new GetPrimaryKeys_argsTupleSchemeFactory()); + } + + private TGetPrimaryKeysReq req; // 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 { + REQ((short)1, "req"); + + 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: // REQ + return REQ; + 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.REQ, new org.apache.thrift.meta_data.FieldMetaData("req", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGetPrimaryKeysReq.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetPrimaryKeys_args.class, metaDataMap); + } + + public GetPrimaryKeys_args() { + } + + public GetPrimaryKeys_args( + TGetPrimaryKeysReq req) + { + this(); + this.req = req; + } + + /** + * Performs a deep copy on other. + */ + public GetPrimaryKeys_args(GetPrimaryKeys_args other) { + if (other.isSetReq()) { + this.req = new TGetPrimaryKeysReq(other.req); + } + } + + public GetPrimaryKeys_args deepCopy() { + return new GetPrimaryKeys_args(this); + } + + @Override + public void clear() { + this.req = null; + } + + public TGetPrimaryKeysReq getReq() { + return this.req; + } + + public void setReq(TGetPrimaryKeysReq req) { + this.req = req; + } + + public void unsetReq() { + this.req = null; + } + + /** Returns true if field req is set (has been assigned a value) and false otherwise */ + public boolean isSetReq() { + return this.req != null; + } + + public void setReqIsSet(boolean value) { + if (!value) { + this.req = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case REQ: + if (value == null) { + unsetReq(); + } else { + setReq((TGetPrimaryKeysReq)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case REQ: + return getReq(); + + } + 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 REQ: + return isSetReq(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof GetPrimaryKeys_args) + return this.equals((GetPrimaryKeys_args)that); + return false; + } + + public boolean equals(GetPrimaryKeys_args that) { + if (that == null) + return false; + + boolean this_present_req = true && this.isSetReq(); + boolean that_present_req = true && that.isSetReq(); + if (this_present_req || that_present_req) { + if (!(this_present_req && that_present_req)) + return false; + if (!this.req.equals(that.req)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_req = true && (isSetReq()); + list.add(present_req); + if (present_req) + list.add(req); + + return list.hashCode(); + } + + @Override + public int compareTo(GetPrimaryKeys_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetReq()).compareTo(other.isSetReq()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetReq()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.req, other.req); + 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("GetPrimaryKeys_args("); + boolean first = true; + + sb.append("req:"); + if (this.req == null) { + sb.append("null"); + } else { + sb.append(this.req); + } + 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 (req != null) { + req.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 GetPrimaryKeys_argsStandardSchemeFactory implements SchemeFactory { + public GetPrimaryKeys_argsStandardScheme getScheme() { + return new GetPrimaryKeys_argsStandardScheme(); + } + } + + private static class GetPrimaryKeys_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, GetPrimaryKeys_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: // REQ + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.req = new TGetPrimaryKeysReq(); + struct.req.read(iprot); + struct.setReqIsSet(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, GetPrimaryKeys_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.req != null) { + oprot.writeFieldBegin(REQ_FIELD_DESC); + struct.req.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class GetPrimaryKeys_argsTupleSchemeFactory implements SchemeFactory { + public GetPrimaryKeys_argsTupleScheme getScheme() { + return new GetPrimaryKeys_argsTupleScheme(); + } + } + + private static class GetPrimaryKeys_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, GetPrimaryKeys_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetReq()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetReq()) { + struct.req.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, GetPrimaryKeys_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.req = new TGetPrimaryKeysReq(); + struct.req.read(iprot); + struct.setReqIsSet(true); + } + } + } + + } + + public static class GetPrimaryKeys_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetPrimaryKeys_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new GetPrimaryKeys_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new GetPrimaryKeys_resultTupleSchemeFactory()); + } + + private TGetPrimaryKeysResp success; // 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"); + + 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; + 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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGetPrimaryKeysResp.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetPrimaryKeys_result.class, metaDataMap); + } + + public GetPrimaryKeys_result() { + } + + public GetPrimaryKeys_result( + TGetPrimaryKeysResp success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on other. + */ + public GetPrimaryKeys_result(GetPrimaryKeys_result other) { + if (other.isSetSuccess()) { + this.success = new TGetPrimaryKeysResp(other.success); + } + } + + public GetPrimaryKeys_result deepCopy() { + return new GetPrimaryKeys_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public TGetPrimaryKeysResp getSuccess() { + return this.success; + } + + public void setSuccess(TGetPrimaryKeysResp 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 void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((TGetPrimaryKeysResp)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + 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(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof GetPrimaryKeys_result) + return this.equals((GetPrimaryKeys_result)that); + return false; + } + + public boolean equals(GetPrimaryKeys_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; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(GetPrimaryKeys_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + 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("GetPrimaryKeys_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + 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 GetPrimaryKeys_resultStandardSchemeFactory implements SchemeFactory { + public GetPrimaryKeys_resultStandardScheme getScheme() { + return new GetPrimaryKeys_resultStandardScheme(); + } + } + + private static class GetPrimaryKeys_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, GetPrimaryKeys_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 TGetPrimaryKeysResp(); + struct.success.read(iprot); + struct.setSuccessIsSet(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, GetPrimaryKeys_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(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class GetPrimaryKeys_resultTupleSchemeFactory implements SchemeFactory { + public GetPrimaryKeys_resultTupleScheme getScheme() { + return new GetPrimaryKeys_resultTupleScheme(); + } + } + + private static class GetPrimaryKeys_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, GetPrimaryKeys_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, GetPrimaryKeys_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new TGetPrimaryKeysResp(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + } + + public static class GetCrossReference_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetCrossReference_args"); + + private static final org.apache.thrift.protocol.TField REQ_FIELD_DESC = new org.apache.thrift.protocol.TField("req", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new GetCrossReference_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new GetCrossReference_argsTupleSchemeFactory()); + } + + private TGetCrossReferenceReq req; // 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 { + REQ((short)1, "req"); + + 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: // REQ + return REQ; + 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.REQ, new org.apache.thrift.meta_data.FieldMetaData("req", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGetCrossReferenceReq.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetCrossReference_args.class, metaDataMap); + } + + public GetCrossReference_args() { + } + + public GetCrossReference_args( + TGetCrossReferenceReq req) + { + this(); + this.req = req; + } + + /** + * Performs a deep copy on other. + */ + public GetCrossReference_args(GetCrossReference_args other) { + if (other.isSetReq()) { + this.req = new TGetCrossReferenceReq(other.req); + } + } + + public GetCrossReference_args deepCopy() { + return new GetCrossReference_args(this); + } + + @Override + public void clear() { + this.req = null; + } + + public TGetCrossReferenceReq getReq() { + return this.req; + } + + public void setReq(TGetCrossReferenceReq req) { + this.req = req; + } + + public void unsetReq() { + this.req = null; + } + + /** Returns true if field req is set (has been assigned a value) and false otherwise */ + public boolean isSetReq() { + return this.req != null; + } + + public void setReqIsSet(boolean value) { + if (!value) { + this.req = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case REQ: + if (value == null) { + unsetReq(); + } else { + setReq((TGetCrossReferenceReq)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case REQ: + return getReq(); + + } + 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 REQ: + return isSetReq(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof GetCrossReference_args) + return this.equals((GetCrossReference_args)that); + return false; + } + + public boolean equals(GetCrossReference_args that) { + if (that == null) + return false; + + boolean this_present_req = true && this.isSetReq(); + boolean that_present_req = true && that.isSetReq(); + if (this_present_req || that_present_req) { + if (!(this_present_req && that_present_req)) + return false; + if (!this.req.equals(that.req)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_req = true && (isSetReq()); + list.add(present_req); + if (present_req) + list.add(req); + + return list.hashCode(); + } + + @Override + public int compareTo(GetCrossReference_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetReq()).compareTo(other.isSetReq()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetReq()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.req, other.req); + 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("GetCrossReference_args("); + boolean first = true; + + sb.append("req:"); + if (this.req == null) { + sb.append("null"); + } else { + sb.append(this.req); + } + 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 (req != null) { + req.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 GetCrossReference_argsStandardSchemeFactory implements SchemeFactory { + public GetCrossReference_argsStandardScheme getScheme() { + return new GetCrossReference_argsStandardScheme(); + } + } + + private static class GetCrossReference_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, GetCrossReference_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: // REQ + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.req = new TGetCrossReferenceReq(); + struct.req.read(iprot); + struct.setReqIsSet(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, GetCrossReference_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.req != null) { + oprot.writeFieldBegin(REQ_FIELD_DESC); + struct.req.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class GetCrossReference_argsTupleSchemeFactory implements SchemeFactory { + public GetCrossReference_argsTupleScheme getScheme() { + return new GetCrossReference_argsTupleScheme(); + } + } + + private static class GetCrossReference_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, GetCrossReference_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetReq()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetReq()) { + struct.req.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, GetCrossReference_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.req = new TGetCrossReferenceReq(); + struct.req.read(iprot); + struct.setReqIsSet(true); + } + } + } + + } + + public static class GetCrossReference_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetCrossReference_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new GetCrossReference_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new GetCrossReference_resultTupleSchemeFactory()); + } + + private TGetCrossReferenceResp success; // 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"); + + 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; + 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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGetCrossReferenceResp.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetCrossReference_result.class, metaDataMap); + } + + public GetCrossReference_result() { + } + + public GetCrossReference_result( + TGetCrossReferenceResp success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on other. + */ + public GetCrossReference_result(GetCrossReference_result other) { + if (other.isSetSuccess()) { + this.success = new TGetCrossReferenceResp(other.success); + } + } + + public GetCrossReference_result deepCopy() { + return new GetCrossReference_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public TGetCrossReferenceResp getSuccess() { + return this.success; + } + + public void setSuccess(TGetCrossReferenceResp 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 void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((TGetCrossReferenceResp)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + 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(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof GetCrossReference_result) + return this.equals((GetCrossReference_result)that); + return false; + } + + public boolean equals(GetCrossReference_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; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(GetCrossReference_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + 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("GetCrossReference_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + 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 GetCrossReference_resultStandardSchemeFactory implements SchemeFactory { + public GetCrossReference_resultStandardScheme getScheme() { + return new GetCrossReference_resultStandardScheme(); + } + } + + private static class GetCrossReference_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, GetCrossReference_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 TGetCrossReferenceResp(); + struct.success.read(iprot); + struct.setSuccessIsSet(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, GetCrossReference_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(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class GetCrossReference_resultTupleSchemeFactory implements SchemeFactory { + public GetCrossReference_resultTupleScheme getScheme() { + return new GetCrossReference_resultTupleScheme(); + } + } + + private static class GetCrossReference_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, GetCrossReference_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, GetCrossReference_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new TGetCrossReferenceResp(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + } + public static class GetOperationStatus_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetOperationStatus_args"); diff --git a/service-rpc/src/gen/thrift/gen-php/TCLIService.php b/service-rpc/src/gen/thrift/gen-php/TCLIService.php index eba62f1..d283145 100644 --- a/service-rpc/src/gen/thrift/gen-php/TCLIService.php +++ b/service-rpc/src/gen/thrift/gen-php/TCLIService.php @@ -72,6 +72,16 @@ interface TCLIServiceIf { */ public function GetFunctions(\TGetFunctionsReq $req); /** + * @param \TGetPrimaryKeysReq $req + * @return \TGetPrimaryKeysResp + */ + public function GetPrimaryKeys(\TGetPrimaryKeysReq $req); + /** + * @param \TGetCrossReferenceReq $req + * @return \TGetCrossReferenceResp + */ + public function GetCrossReference(\TGetCrossReferenceReq $req); + /** * @param \TGetOperationStatusReq $req * @return \TGetOperationStatusResp */ @@ -685,6 +695,108 @@ class TCLIServiceClient implements \TCLIServiceIf { throw new \Exception("GetFunctions failed: unknown result"); } + public function GetPrimaryKeys(\TGetPrimaryKeysReq $req) + { + $this->send_GetPrimaryKeys($req); + return $this->recv_GetPrimaryKeys(); + } + + public function send_GetPrimaryKeys(\TGetPrimaryKeysReq $req) + { + $args = new \TCLIService_GetPrimaryKeys_args(); + $args->req = $req; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'GetPrimaryKeys', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('GetPrimaryKeys', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_GetPrimaryKeys() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\TCLIService_GetPrimaryKeys_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 \TCLIService_GetPrimaryKeys_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("GetPrimaryKeys failed: unknown result"); + } + + public function GetCrossReference(\TGetCrossReferenceReq $req) + { + $this->send_GetCrossReference($req); + return $this->recv_GetCrossReference(); + } + + public function send_GetCrossReference(\TGetCrossReferenceReq $req) + { + $args = new \TCLIService_GetCrossReference_args(); + $args->req = $req; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'GetCrossReference', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('GetCrossReference', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_GetCrossReference() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\TCLIService_GetCrossReference_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 \TCLIService_GetCrossReference_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("GetCrossReference failed: unknown result"); + } + public function GetOperationStatus(\TGetOperationStatusReq $req) { $this->send_GetOperationStatus($req); @@ -2857,6 +2969,326 @@ class TCLIService_GetFunctions_result { } +class TCLIService_GetPrimaryKeys_args { + static $_TSPEC; + + /** + * @var \TGetPrimaryKeysReq + */ + public $req = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'req', + 'type' => TType::STRUCT, + 'class' => '\TGetPrimaryKeysReq', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['req'])) { + $this->req = $vals['req']; + } + } + } + + public function getName() { + return 'TCLIService_GetPrimaryKeys_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->req = new \TGetPrimaryKeysReq(); + $xfer += $this->req->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('TCLIService_GetPrimaryKeys_args'); + if ($this->req !== null) { + if (!is_object($this->req)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('req', TType::STRUCT, 1); + $xfer += $this->req->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TCLIService_GetPrimaryKeys_result { + static $_TSPEC; + + /** + * @var \TGetPrimaryKeysResp + */ + public $success = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRUCT, + 'class' => '\TGetPrimaryKeysResp', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + } + } + + public function getName() { + return 'TCLIService_GetPrimaryKeys_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::STRUCT) { + $this->success = new \TGetPrimaryKeysResp(); + $xfer += $this->success->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('TCLIService_GetPrimaryKeys_result'); + if ($this->success !== null) { + if (!is_object($this->success)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0); + $xfer += $this->success->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TCLIService_GetCrossReference_args { + static $_TSPEC; + + /** + * @var \TGetCrossReferenceReq + */ + public $req = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'req', + 'type' => TType::STRUCT, + 'class' => '\TGetCrossReferenceReq', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['req'])) { + $this->req = $vals['req']; + } + } + } + + public function getName() { + return 'TCLIService_GetCrossReference_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->req = new \TGetCrossReferenceReq(); + $xfer += $this->req->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('TCLIService_GetCrossReference_args'); + if ($this->req !== null) { + if (!is_object($this->req)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('req', TType::STRUCT, 1); + $xfer += $this->req->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TCLIService_GetCrossReference_result { + static $_TSPEC; + + /** + * @var \TGetCrossReferenceResp + */ + public $success = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRUCT, + 'class' => '\TGetCrossReferenceResp', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + } + } + + public function getName() { + return 'TCLIService_GetCrossReference_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::STRUCT) { + $this->success = new \TGetCrossReferenceResp(); + $xfer += $this->success->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('TCLIService_GetCrossReference_result'); + if ($this->success !== null) { + if (!is_object($this->success)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0); + $xfer += $this->success->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class TCLIService_GetOperationStatus_args { static $_TSPEC; diff --git a/service-rpc/src/gen/thrift/gen-php/Types.php b/service-rpc/src/gen/thrift/gen-php/Types.php index b7df50a..faea15d 100644 --- a/service-rpc/src/gen/thrift/gen-php/Types.php +++ b/service-rpc/src/gen/thrift/gen-php/Types.php @@ -7313,6 +7313,589 @@ class TGetFunctionsResp { } +class TGetPrimaryKeysReq { + static $_TSPEC; + + /** + * @var \TSessionHandle + */ + public $sessionHandle = null; + /** + * @var string + */ + public $catalogName = null; + /** + * @var string + */ + public $schemaName = null; + /** + * @var string + */ + public $tableName = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'sessionHandle', + 'type' => TType::STRUCT, + 'class' => '\TSessionHandle', + ), + 2 => array( + 'var' => 'catalogName', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'schemaName', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'tableName', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['sessionHandle'])) { + $this->sessionHandle = $vals['sessionHandle']; + } + if (isset($vals['catalogName'])) { + $this->catalogName = $vals['catalogName']; + } + if (isset($vals['schemaName'])) { + $this->schemaName = $vals['schemaName']; + } + if (isset($vals['tableName'])) { + $this->tableName = $vals['tableName']; + } + } + } + + public function getName() { + return 'TGetPrimaryKeysReq'; + } + + 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->sessionHandle = new \TSessionHandle(); + $xfer += $this->sessionHandle->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->catalogName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->schemaName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->tableName); + } 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('TGetPrimaryKeysReq'); + if ($this->sessionHandle !== null) { + if (!is_object($this->sessionHandle)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1); + $xfer += $this->sessionHandle->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->catalogName !== null) { + $xfer += $output->writeFieldBegin('catalogName', TType::STRING, 2); + $xfer += $output->writeString($this->catalogName); + $xfer += $output->writeFieldEnd(); + } + if ($this->schemaName !== null) { + $xfer += $output->writeFieldBegin('schemaName', TType::STRING, 3); + $xfer += $output->writeString($this->schemaName); + $xfer += $output->writeFieldEnd(); + } + if ($this->tableName !== null) { + $xfer += $output->writeFieldBegin('tableName', TType::STRING, 4); + $xfer += $output->writeString($this->tableName); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TGetPrimaryKeysResp { + static $_TSPEC; + + /** + * @var \TStatus + */ + public $status = null; + /** + * @var \TOperationHandle + */ + public $operationHandle = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'status', + 'type' => TType::STRUCT, + 'class' => '\TStatus', + ), + 2 => array( + 'var' => 'operationHandle', + 'type' => TType::STRUCT, + 'class' => '\TOperationHandle', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['status'])) { + $this->status = $vals['status']; + } + if (isset($vals['operationHandle'])) { + $this->operationHandle = $vals['operationHandle']; + } + } + } + + public function getName() { + return 'TGetPrimaryKeysResp'; + } + + 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->status = new \TStatus(); + $xfer += $this->status->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRUCT) { + $this->operationHandle = new \TOperationHandle(); + $xfer += $this->operationHandle->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('TGetPrimaryKeysResp'); + if ($this->status !== null) { + if (!is_object($this->status)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1); + $xfer += $this->status->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->operationHandle !== null) { + if (!is_object($this->operationHandle)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2); + $xfer += $this->operationHandle->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TGetCrossReferenceReq { + static $_TSPEC; + + /** + * @var \TSessionHandle + */ + public $sessionHandle = null; + /** + * @var string + */ + public $parentCatalogName = null; + /** + * @var string + */ + public $parentSchemaName = null; + /** + * @var string + */ + public $parentTableName = null; + /** + * @var string + */ + public $foreignCatalogName = null; + /** + * @var string + */ + public $foreignSchemaName = null; + /** + * @var string + */ + public $foreignTableName = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'sessionHandle', + 'type' => TType::STRUCT, + 'class' => '\TSessionHandle', + ), + 2 => array( + 'var' => 'parentCatalogName', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'parentSchemaName', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'parentTableName', + 'type' => TType::STRING, + ), + 5 => array( + 'var' => 'foreignCatalogName', + 'type' => TType::STRING, + ), + 6 => array( + 'var' => 'foreignSchemaName', + 'type' => TType::STRING, + ), + 7 => array( + 'var' => 'foreignTableName', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['sessionHandle'])) { + $this->sessionHandle = $vals['sessionHandle']; + } + if (isset($vals['parentCatalogName'])) { + $this->parentCatalogName = $vals['parentCatalogName']; + } + if (isset($vals['parentSchemaName'])) { + $this->parentSchemaName = $vals['parentSchemaName']; + } + if (isset($vals['parentTableName'])) { + $this->parentTableName = $vals['parentTableName']; + } + if (isset($vals['foreignCatalogName'])) { + $this->foreignCatalogName = $vals['foreignCatalogName']; + } + if (isset($vals['foreignSchemaName'])) { + $this->foreignSchemaName = $vals['foreignSchemaName']; + } + if (isset($vals['foreignTableName'])) { + $this->foreignTableName = $vals['foreignTableName']; + } + } + } + + public function getName() { + return 'TGetCrossReferenceReq'; + } + + 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->sessionHandle = new \TSessionHandle(); + $xfer += $this->sessionHandle->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->parentCatalogName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->parentSchemaName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->parentTableName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->foreignCatalogName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 6: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->foreignSchemaName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 7: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->foreignTableName); + } 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('TGetCrossReferenceReq'); + if ($this->sessionHandle !== null) { + if (!is_object($this->sessionHandle)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1); + $xfer += $this->sessionHandle->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->parentCatalogName !== null) { + $xfer += $output->writeFieldBegin('parentCatalogName', TType::STRING, 2); + $xfer += $output->writeString($this->parentCatalogName); + $xfer += $output->writeFieldEnd(); + } + if ($this->parentSchemaName !== null) { + $xfer += $output->writeFieldBegin('parentSchemaName', TType::STRING, 3); + $xfer += $output->writeString($this->parentSchemaName); + $xfer += $output->writeFieldEnd(); + } + if ($this->parentTableName !== null) { + $xfer += $output->writeFieldBegin('parentTableName', TType::STRING, 4); + $xfer += $output->writeString($this->parentTableName); + $xfer += $output->writeFieldEnd(); + } + if ($this->foreignCatalogName !== null) { + $xfer += $output->writeFieldBegin('foreignCatalogName', TType::STRING, 5); + $xfer += $output->writeString($this->foreignCatalogName); + $xfer += $output->writeFieldEnd(); + } + if ($this->foreignSchemaName !== null) { + $xfer += $output->writeFieldBegin('foreignSchemaName', TType::STRING, 6); + $xfer += $output->writeString($this->foreignSchemaName); + $xfer += $output->writeFieldEnd(); + } + if ($this->foreignTableName !== null) { + $xfer += $output->writeFieldBegin('foreignTableName', TType::STRING, 7); + $xfer += $output->writeString($this->foreignTableName); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TGetCrossReferenceResp { + static $_TSPEC; + + /** + * @var \TStatus + */ + public $status = null; + /** + * @var \TOperationHandle + */ + public $operationHandle = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'status', + 'type' => TType::STRUCT, + 'class' => '\TStatus', + ), + 2 => array( + 'var' => 'operationHandle', + 'type' => TType::STRUCT, + 'class' => '\TOperationHandle', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['status'])) { + $this->status = $vals['status']; + } + if (isset($vals['operationHandle'])) { + $this->operationHandle = $vals['operationHandle']; + } + } + } + + public function getName() { + return 'TGetCrossReferenceResp'; + } + + 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->status = new \TStatus(); + $xfer += $this->status->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRUCT) { + $this->operationHandle = new \TOperationHandle(); + $xfer += $this->operationHandle->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('TGetCrossReferenceResp'); + if ($this->status !== null) { + if (!is_object($this->status)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1); + $xfer += $this->status->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->operationHandle !== null) { + if (!is_object($this->operationHandle)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2); + $xfer += $this->operationHandle->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class TGetOperationStatusReq { static $_TSPEC; diff --git a/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote b/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote index 56f5c5d..62b87a3 100755 --- a/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote +++ b/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote @@ -35,6 +35,8 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' TGetTableTypesResp GetTableTypes(TGetTableTypesReq req)') print(' TGetColumnsResp GetColumns(TGetColumnsReq req)') print(' TGetFunctionsResp GetFunctions(TGetFunctionsReq req)') + print(' TGetPrimaryKeysResp GetPrimaryKeys(TGetPrimaryKeysReq req)') + print(' TGetCrossReferenceResp GetCrossReference(TGetCrossReferenceReq req)') print(' TGetOperationStatusResp GetOperationStatus(TGetOperationStatusReq req)') print(' TCancelOperationResp CancelOperation(TCancelOperationReq req)') print(' TCloseOperationResp CloseOperation(TCloseOperationReq req)') @@ -165,6 +167,18 @@ elif cmd == 'GetFunctions': sys.exit(1) pp.pprint(client.GetFunctions(eval(args[0]),)) +elif cmd == 'GetPrimaryKeys': + if len(args) != 1: + print('GetPrimaryKeys requires 1 args') + sys.exit(1) + pp.pprint(client.GetPrimaryKeys(eval(args[0]),)) + +elif cmd == 'GetCrossReference': + if len(args) != 1: + print('GetCrossReference requires 1 args') + sys.exit(1) + pp.pprint(client.GetCrossReference(eval(args[0]),)) + elif cmd == 'GetOperationStatus': if len(args) != 1: print('GetOperationStatus requires 1 args') diff --git a/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py b/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py index ad2d71d..35f2ae4 100644 --- a/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py +++ b/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py @@ -96,6 +96,20 @@ def GetFunctions(self, req): """ pass + def GetPrimaryKeys(self, req): + """ + Parameters: + - req + """ + pass + + def GetCrossReference(self, req): + """ + Parameters: + - req + """ + pass + def GetOperationStatus(self, req): """ Parameters: @@ -501,6 +515,68 @@ def recv_GetFunctions(self): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "GetFunctions failed: unknown result") + def GetPrimaryKeys(self, req): + """ + Parameters: + - req + """ + self.send_GetPrimaryKeys(req) + return self.recv_GetPrimaryKeys() + + def send_GetPrimaryKeys(self, req): + self._oprot.writeMessageBegin('GetPrimaryKeys', TMessageType.CALL, self._seqid) + args = GetPrimaryKeys_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetPrimaryKeys(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetPrimaryKeys_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetPrimaryKeys failed: unknown result") + + def GetCrossReference(self, req): + """ + Parameters: + - req + """ + self.send_GetCrossReference(req) + return self.recv_GetCrossReference() + + def send_GetCrossReference(self, req): + self._oprot.writeMessageBegin('GetCrossReference', TMessageType.CALL, self._seqid) + args = GetCrossReference_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetCrossReference(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetCrossReference_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetCrossReference failed: unknown result") + def GetOperationStatus(self, req): """ Parameters: @@ -765,6 +841,8 @@ def __init__(self, handler): self._processMap["GetTableTypes"] = Processor.process_GetTableTypes self._processMap["GetColumns"] = Processor.process_GetColumns self._processMap["GetFunctions"] = Processor.process_GetFunctions + self._processMap["GetPrimaryKeys"] = Processor.process_GetPrimaryKeys + self._processMap["GetCrossReference"] = Processor.process_GetCrossReference self._processMap["GetOperationStatus"] = Processor.process_GetOperationStatus self._processMap["CancelOperation"] = Processor.process_CancelOperation self._processMap["CloseOperation"] = Processor.process_CloseOperation @@ -998,6 +1076,44 @@ def process_GetFunctions(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_GetPrimaryKeys(self, seqid, iprot, oprot): + args = GetPrimaryKeys_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetPrimaryKeys_result() + try: + result.success = self._handler.GetPrimaryKeys(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetPrimaryKeys", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetCrossReference(self, seqid, iprot, oprot): + args = GetCrossReference_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetCrossReference_result() + try: + result.success = self._handler.GetCrossReference(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetCrossReference", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_GetOperationStatus(self, seqid, iprot, oprot): args = GetOperationStatus_args() args.read(iprot) @@ -2594,6 +2710,268 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +class GetPrimaryKeys_args: + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetPrimaryKeysReq, TGetPrimaryKeysReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + 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.req = TGetPrimaryKeysReq() + self.req.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('GetPrimaryKeys_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.req) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class GetPrimaryKeys_result: + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetPrimaryKeysResp, TGetPrimaryKeysResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetPrimaryKeysResp() + self.success.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('GetPrimaryKeys_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.success) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class GetCrossReference_args: + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetCrossReferenceReq, TGetCrossReferenceReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + 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.req = TGetCrossReferenceReq() + self.req.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('GetCrossReference_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.req) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class GetCrossReference_result: + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetCrossReferenceResp, TGetCrossReferenceResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetCrossReferenceResp() + self.success.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('GetCrossReference_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.success) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class GetOperationStatus_args: """ Attributes: diff --git a/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py b/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py index c691781..0e45041 100644 --- a/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py +++ b/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py @@ -5559,6 +5559,423 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +class TGetPrimaryKeysReq: + """ + Attributes: + - sessionHandle + - catalogName + - schemaName + - tableName + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'catalogName', None, None, ), # 2 + (3, TType.STRING, 'schemaName', None, None, ), # 3 + (4, TType.STRING, 'tableName', None, None, ), # 4 + ) + + def __init__(self, sessionHandle=None, catalogName=None, schemaName=None, tableName=None,): + self.sessionHandle = sessionHandle + self.catalogName = catalogName + self.schemaName = schemaName + self.tableName = tableName + + 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.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.catalogName = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.schemaName = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.tableName = iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetPrimaryKeysReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.catalogName is not None: + oprot.writeFieldBegin('catalogName', TType.STRING, 2) + oprot.writeString(self.catalogName) + oprot.writeFieldEnd() + if self.schemaName is not None: + oprot.writeFieldBegin('schemaName', TType.STRING, 3) + oprot.writeString(self.schemaName) + oprot.writeFieldEnd() + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRING, 4) + oprot.writeString(self.tableName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocol.TProtocolException(message='Required field sessionHandle is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.sessionHandle) + value = (value * 31) ^ hash(self.catalogName) + value = (value * 31) ^ hash(self.schemaName) + value = (value * 31) ^ hash(self.tableName) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TGetPrimaryKeysResp: + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + 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.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.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('TGetPrimaryKeysResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocol.TProtocolException(message='Required field status is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.status) + value = (value * 31) ^ hash(self.operationHandle) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TGetCrossReferenceReq: + """ + Attributes: + - sessionHandle + - parentCatalogName + - parentSchemaName + - parentTableName + - foreignCatalogName + - foreignSchemaName + - foreignTableName + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'parentCatalogName', None, None, ), # 2 + (3, TType.STRING, 'parentSchemaName', None, None, ), # 3 + (4, TType.STRING, 'parentTableName', None, None, ), # 4 + (5, TType.STRING, 'foreignCatalogName', None, None, ), # 5 + (6, TType.STRING, 'foreignSchemaName', None, None, ), # 6 + (7, TType.STRING, 'foreignTableName', None, None, ), # 7 + ) + + def __init__(self, sessionHandle=None, parentCatalogName=None, parentSchemaName=None, parentTableName=None, foreignCatalogName=None, foreignSchemaName=None, foreignTableName=None,): + self.sessionHandle = sessionHandle + self.parentCatalogName = parentCatalogName + self.parentSchemaName = parentSchemaName + self.parentTableName = parentTableName + self.foreignCatalogName = foreignCatalogName + self.foreignSchemaName = foreignSchemaName + self.foreignTableName = foreignTableName + + 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.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.parentCatalogName = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.parentSchemaName = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.parentTableName = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.foreignCatalogName = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRING: + self.foreignSchemaName = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRING: + self.foreignTableName = iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetCrossReferenceReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.parentCatalogName is not None: + oprot.writeFieldBegin('parentCatalogName', TType.STRING, 2) + oprot.writeString(self.parentCatalogName) + oprot.writeFieldEnd() + if self.parentSchemaName is not None: + oprot.writeFieldBegin('parentSchemaName', TType.STRING, 3) + oprot.writeString(self.parentSchemaName) + oprot.writeFieldEnd() + if self.parentTableName is not None: + oprot.writeFieldBegin('parentTableName', TType.STRING, 4) + oprot.writeString(self.parentTableName) + oprot.writeFieldEnd() + if self.foreignCatalogName is not None: + oprot.writeFieldBegin('foreignCatalogName', TType.STRING, 5) + oprot.writeString(self.foreignCatalogName) + oprot.writeFieldEnd() + if self.foreignSchemaName is not None: + oprot.writeFieldBegin('foreignSchemaName', TType.STRING, 6) + oprot.writeString(self.foreignSchemaName) + oprot.writeFieldEnd() + if self.foreignTableName is not None: + oprot.writeFieldBegin('foreignTableName', TType.STRING, 7) + oprot.writeString(self.foreignTableName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocol.TProtocolException(message='Required field sessionHandle is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.sessionHandle) + value = (value * 31) ^ hash(self.parentCatalogName) + value = (value * 31) ^ hash(self.parentSchemaName) + value = (value * 31) ^ hash(self.parentTableName) + value = (value * 31) ^ hash(self.foreignCatalogName) + value = (value * 31) ^ hash(self.foreignSchemaName) + value = (value * 31) ^ hash(self.foreignTableName) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TGetCrossReferenceResp: + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + 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.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.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('TGetCrossReferenceResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocol.TProtocolException(message='Required field status is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.status) + value = (value * 31) ^ hash(self.operationHandle) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class TGetOperationStatusReq: """ Attributes: diff --git a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb index 7d7f7a7..a50fe25 100644 --- a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb +++ b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb @@ -176,6 +176,36 @@ module TCLIService raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'GetFunctions failed: unknown result') end + def GetPrimaryKeys(req) + send_GetPrimaryKeys(req) + return recv_GetPrimaryKeys() + end + + def send_GetPrimaryKeys(req) + send_message('GetPrimaryKeys', GetPrimaryKeys_args, :req => req) + end + + def recv_GetPrimaryKeys() + result = receive_message(GetPrimaryKeys_result) + return result.success unless result.success.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'GetPrimaryKeys failed: unknown result') + end + + def GetCrossReference(req) + send_GetCrossReference(req) + return recv_GetCrossReference() + end + + def send_GetCrossReference(req) + send_message('GetCrossReference', GetCrossReference_args, :req => req) + end + + def recv_GetCrossReference() + result = receive_message(GetCrossReference_result) + return result.success unless result.success.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'GetCrossReference failed: unknown result') + end + def GetOperationStatus(req) send_GetOperationStatus(req) return recv_GetOperationStatus() @@ -378,6 +408,20 @@ module TCLIService write_result(result, oprot, 'GetFunctions', seqid) end + def process_GetPrimaryKeys(seqid, iprot, oprot) + args = read_args(iprot, GetPrimaryKeys_args) + result = GetPrimaryKeys_result.new() + result.success = @handler.GetPrimaryKeys(args.req) + write_result(result, oprot, 'GetPrimaryKeys', seqid) + end + + def process_GetCrossReference(seqid, iprot, oprot) + args = read_args(iprot, GetCrossReference_args) + result = GetCrossReference_result.new() + result.success = @handler.GetCrossReference(args.req) + write_result(result, oprot, 'GetCrossReference', seqid) + end + def process_GetOperationStatus(seqid, iprot, oprot) args = read_args(iprot, GetOperationStatus_args) result = GetOperationStatus_result.new() @@ -790,6 +834,70 @@ module TCLIService ::Thrift::Struct.generate_accessors self end + class GetPrimaryKeys_args + include ::Thrift::Struct, ::Thrift::Struct_Union + REQ = 1 + + FIELDS = { + REQ => {:type => ::Thrift::Types::STRUCT, :name => 'req', :class => ::TGetPrimaryKeysReq} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class GetPrimaryKeys_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::TGetPrimaryKeysResp} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class GetCrossReference_args + include ::Thrift::Struct, ::Thrift::Struct_Union + REQ = 1 + + FIELDS = { + REQ => {:type => ::Thrift::Types::STRUCT, :name => 'req', :class => ::TGetCrossReferenceReq} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class GetCrossReference_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::TGetCrossReferenceResp} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + class GetOperationStatus_args include ::Thrift::Struct, ::Thrift::Struct_Union REQ = 1 diff --git a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb index 07ed97c..14bc69d 100644 --- a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb +++ b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb @@ -1447,6 +1447,96 @@ class TGetFunctionsResp ::Thrift::Struct.generate_accessors self end +class TGetPrimaryKeysReq + include ::Thrift::Struct, ::Thrift::Struct_Union + SESSIONHANDLE = 1 + CATALOGNAME = 2 + SCHEMANAME = 3 + TABLENAME = 4 + + FIELDS = { + SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::TSessionHandle}, + CATALOGNAME => {:type => ::Thrift::Types::STRING, :name => 'catalogName', :optional => true}, + SCHEMANAME => {:type => ::Thrift::Types::STRING, :name => 'schemaName', :optional => true}, + TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tableName', :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field sessionHandle is unset!') unless @sessionHandle + end + + ::Thrift::Struct.generate_accessors self +end + +class TGetPrimaryKeysResp + include ::Thrift::Struct, ::Thrift::Struct_Union + STATUS = 1 + OPERATIONHANDLE = 2 + + FIELDS = { + STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::TStatus}, + OPERATIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'operationHandle', :class => ::TOperationHandle, :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status + end + + ::Thrift::Struct.generate_accessors self +end + +class TGetCrossReferenceReq + include ::Thrift::Struct, ::Thrift::Struct_Union + SESSIONHANDLE = 1 + PARENTCATALOGNAME = 2 + PARENTSCHEMANAME = 3 + PARENTTABLENAME = 4 + FOREIGNCATALOGNAME = 5 + FOREIGNSCHEMANAME = 6 + FOREIGNTABLENAME = 7 + + FIELDS = { + SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::TSessionHandle}, + PARENTCATALOGNAME => {:type => ::Thrift::Types::STRING, :name => 'parentCatalogName', :optional => true}, + PARENTSCHEMANAME => {:type => ::Thrift::Types::STRING, :name => 'parentSchemaName', :optional => true}, + PARENTTABLENAME => {:type => ::Thrift::Types::STRING, :name => 'parentTableName', :optional => true}, + FOREIGNCATALOGNAME => {:type => ::Thrift::Types::STRING, :name => 'foreignCatalogName', :optional => true}, + FOREIGNSCHEMANAME => {:type => ::Thrift::Types::STRING, :name => 'foreignSchemaName', :optional => true}, + FOREIGNTABLENAME => {:type => ::Thrift::Types::STRING, :name => 'foreignTableName', :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field sessionHandle is unset!') unless @sessionHandle + end + + ::Thrift::Struct.generate_accessors self +end + +class TGetCrossReferenceResp + include ::Thrift::Struct, ::Thrift::Struct_Union + STATUS = 1 + OPERATIONHANDLE = 2 + + FIELDS = { + STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::TStatus}, + OPERATIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'operationHandle', :class => ::TOperationHandle, :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status + end + + ::Thrift::Struct.generate_accessors self +end + class TGetOperationStatusReq include ::Thrift::Struct, ::Thrift::Struct_Union OPERATIONHANDLE = 1 diff --git a/service/src/java/org/apache/hive/service/cli/CLIService.java b/service/src/java/org/apache/hive/service/cli/CLIService.java index ab30ae2..4a83e38 100644 --- a/service/src/java/org/apache/hive/service/cli/CLIService.java +++ b/service/src/java/org/apache/hive/service/cli/CLIService.java @@ -365,6 +365,36 @@ public OperationHandle getFunctions(SessionHandle sessionHandle, } /* (non-Javadoc) + * @see org.apache.hive.service.cli.ICLIService#getPrimaryKeys(org.apache.hive.service.cli.SessionHandle) + */ + @Override + public OperationHandle getPrimaryKeys(SessionHandle sessionHandle, + String catalog, String schema, String table) + throws HiveSQLException { + OperationHandle opHandle = sessionManager.getSession(sessionHandle) + .getPrimaryKeys(catalog, schema, table); + LOG.debug(sessionHandle + ": getPrimaryKeys()"); + return opHandle; + } + + /* (non-Javadoc) + * @see org.apache.hive.service.cli.ICLIService#getCrossReference(org.apache.hive.service.cli.SessionHandle) + */ + @Override + public OperationHandle getCrossReference(SessionHandle sessionHandle, + String primaryCatalog, + String primarySchema, String primaryTable, String foreignCatalog, + String foreignSchema, String foreignTable) + throws HiveSQLException { + OperationHandle opHandle = sessionManager.getSession(sessionHandle) + .getCrossReference(primaryCatalog, primarySchema, primaryTable, + foreignCatalog, + foreignSchema, foreignTable); + LOG.debug(sessionHandle + ": getCrossReference()"); + return opHandle; + } + + /* (non-Javadoc) * @see org.apache.hive.service.cli.ICLIService#getOperationStatus(org.apache.hive.service.cli.OperationHandle) */ @Override diff --git a/service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java b/service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java index 9cad5be..79e0024 100644 --- a/service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java +++ b/service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java @@ -205,4 +205,19 @@ public void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory au String tokenStr) throws HiveSQLException { cliService.renewDelegationToken(sessionHandle, authFactory, tokenStr); } + + @Override + public OperationHandle getPrimaryKeys(SessionHandle sessionHandle, + String catalog, String schema, String table) throws HiveSQLException { + return cliService.getPrimaryKeys(sessionHandle, catalog, schema, table); + } + + @Override + public OperationHandle getCrossReference(SessionHandle sessionHandle, + String primaryCatalog, String primarySchema, String primaryTable, + String foreignCatalog, String foreignSchema, String foreignTable) + throws HiveSQLException { + return cliService.getCrossReference(sessionHandle, primaryCatalog, primarySchema, + primaryTable, foreignCatalog, foreignSchema, foreignTable); + } } diff --git a/service/src/java/org/apache/hive/service/cli/ICLIService.java b/service/src/java/org/apache/hive/service/cli/ICLIService.java index 0a54bdd..e4aef96 100644 --- a/service/src/java/org/apache/hive/service/cli/ICLIService.java +++ b/service/src/java/org/apache/hive/service/cli/ICLIService.java @@ -98,5 +98,13 @@ void cancelDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFact void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException; + OperationHandle getPrimaryKeys(SessionHandle sessionHandle, String catalog, + String schema, String table) throws HiveSQLException; + + OperationHandle getCrossReference(SessionHandle sessionHandle, + String primaryCatalog, String primarySchema, String primaryTable, + String foreignCatalog, String foreignSchema, String foreignTable) + throws HiveSQLException; + } diff --git a/service/src/java/org/apache/hive/service/cli/operation/GetCrossReferenceOperation.java b/service/src/java/org/apache/hive/service/cli/operation/GetCrossReferenceOperation.java new file mode 100644 index 0000000..42ed040 --- /dev/null +++ b/service/src/java/org/apache/hive/service/cli/operation/GetCrossReferenceOperation.java @@ -0,0 +1,168 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hive.service.cli.operation; + +import java.util.List; + +import org.apache.commons.lang.NumberUtils; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.metastore.IMetaStoreClient; +import org.apache.hadoop.hive.metastore.api.SQLForeignKey; +import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey; +import org.apache.hive.service.cli.FetchOrientation; +import org.apache.hive.service.cli.HiveSQLException; +import org.apache.hive.service.cli.OperationState; +import org.apache.hive.service.cli.OperationType; +import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; +import org.apache.hive.service.cli.TableSchema; +import org.apache.hive.service.cli.Type; +import org.apache.hive.service.cli.session.HiveSession; + +/** + * GetCrossReferenceOperation. + * + */ +public class GetCrossReferenceOperation extends MetadataOperation { +/** +PKTABLE_CAT String => parent key table catalog (may be null) +PKTABLE_SCHEM String => parent key table schema (may be null) +PKTABLE_NAME String => parent key table name +PKCOLUMN_NAME String => parent key column name +FKTABLE_CAT String => foreign key table catalog (may be null) being exported (may be null) +FKTABLE_SCHEM String => foreign key table schema (may be null) being exported (may be null) +FKTABLE_NAME String => foreign key table name being exported +FKCOLUMN_NAME String => foreign key column name being exported +KEY_SEQ short => sequence number within foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key). +UPDATE_RULE short => What happens to foreign key when parent key is updated: +importedNoAction - do not allow update of parent key if it has been imported +importedKeyCascade - change imported key to agree with parent key update +importedKeySetNull - change imported key to NULL if its parent key has been updated +importedKeySetDefault - change imported key to default values if its parent key has been updated +importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility) +DELETE_RULE short => What happens to the foreign key when parent key is deleted. +importedKeyNoAction - do not allow delete of parent key if it has been imported +importedKeyCascade - delete rows that import a deleted key +importedKeySetNull - change imported key to NULL if its primary key has been deleted +importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility) +importedKeySetDefault - change imported key to default if its parent key has been deleted +FK_NAME String => foreign key name (may be null) +PK_NAME String => parent key name (may be null) +DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit +importedKeyInitiallyDeferred - see SQL92 for definition +importedKeyInitiallyImmediate - see SQL92 for definition +importedKeyNotDeferrable - see SQL92 for definition + */ + private static final TableSchema RESULT_SET_SCHEMA = new TableSchema() + .addPrimitiveColumn("PKTABLE_CAT", Type.STRING_TYPE, + "Parent key table catalog (may be null)") + .addPrimitiveColumn("PKTABLE_SCHEM", Type.STRING_TYPE, + "Parent key table schema (may be null)") + .addPrimitiveColumn("PKTABLE_NAME", Type.STRING_TYPE, + "Parent Key table name") + .addPrimitiveColumn("PKCOLUMN_NAME", Type.STRING_TYPE, + "Parent Key column name") + .addPrimitiveColumn("FKTABLE_CAT", Type.STRING_TYPE, + "Foreign key table catalog (may be null)") + .addPrimitiveColumn("FKTABLE_SCHEM", Type.STRING_TYPE, + "Foreign key table schema (may be null)") + .addPrimitiveColumn("FKTABLE_NAME", Type.STRING_TYPE, + "Foreign Key table name") + .addPrimitiveColumn("FKCOLUMN_NAME", Type.STRING_TYPE, + "Foreign Key column name") + .addPrimitiveColumn("KEQ_SEQ", Type.INT_TYPE, + "Sequence number within primary key") + .addPrimitiveColumn("UPDATE_RULE", Type.INT_TYPE, + "What happens to foreign key when parent key is updated") + .addPrimitiveColumn("DELETE_RULE", Type.INT_TYPE, + "What happens to foreign key when parent key is deleted") + .addPrimitiveColumn("FK_NAME", Type.STRING_TYPE, + "Foreign key name (may be null)") + .addPrimitiveColumn("PK_NAME", Type.STRING_TYPE, + "Primary key name (may be null)") + .addPrimitiveColumn("DEFERRABILITY", Type.INT_TYPE, + "Can the evaluation of foreign key constraints be deferred until commit"); + private final String parentCatalogName; + private final String parentSchemaName; + private final String parentTableName; + private final String foreignCatalogName; + private final String foreignSchemaName; + private final String foreignTableName; + private final RowSet rowSet; + + public GetCrossReferenceOperation(HiveSession parentSession, + String parentCatalogName, String parentSchemaName, String parentTableName, + String foreignCatalog, String foreignSchema, String foreignTable) { + super(parentSession, OperationType.GET_FUNCTIONS); + this.parentCatalogName = parentCatalogName; + this.parentSchemaName = parentSchemaName; + this.parentTableName = parentTableName; + this.foreignCatalogName = foreignCatalog; + this.foreignSchemaName = foreignSchema; + this.foreignTableName = foreignTable; + this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); + } + + @Override + public void runInternal() throws HiveSQLException { + setState(OperationState.RUNNING); + try { + IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); + List fks = metastoreClient.getForeignKeys(parentSchemaName, parentTableName, foreignSchemaName, foreignTableName); + if (fks == null) { + return; + } + for (SQLForeignKey fk : fks) { + rowSet.addRow(new Object[] {parentCatalogName, + fk.getPktable_schem(), fk.getPktable_name(), fk.getPkcolumn_name(), + foreignCatalogName, + fk.getFktable_schem(), fk.getFktable_name(), fk.getFkcolumn_name(), + fk.getKey_seq(), fk.getUpdate_rule(), fk.getDelete_rule(), fk.getFk_name(), + fk.getPk_name(), 0}); + } + setState(OperationState.FINISHED); + } catch (Exception e) { + setState(OperationState.ERROR); + throw new HiveSQLException(e); + } + } + + + /* (non-Javadoc) + * @see org.apache.hive.service.cli.Operation#getResultSetSchema() + */ + @Override + public TableSchema getResultSetSchema() throws HiveSQLException { + assertState(OperationState.FINISHED); + return RESULT_SET_SCHEMA; + } + + /* (non-Javadoc) + * @see org.apache.hive.service.cli.Operation#getNextRowSet(org.apache.hive.service.cli.FetchOrientation, long) + */ + @Override + public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { + assertState(OperationState.FINISHED); + validateDefaultFetchOrientation(orientation); + if (orientation.equals(FetchOrientation.FETCH_FIRST)) { + rowSet.setStartOffset(0); + } + return rowSet.extractSubset((int)maxRows); + } +} diff --git a/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java b/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java new file mode 100644 index 0000000..520b65a --- /dev/null +++ b/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java @@ -0,0 +1,122 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hive.service.cli.operation; + +import java.util.List; + +import org.apache.commons.lang.NumberUtils; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.metastore.IMetaStoreClient; +import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey; +import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType; +import org.apache.hive.service.cli.FetchOrientation; +import org.apache.hive.service.cli.HiveSQLException; +import org.apache.hive.service.cli.OperationState; +import org.apache.hive.service.cli.OperationType; +import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; +import org.apache.hive.service.cli.TableSchema; +import org.apache.hive.service.cli.Type; +import org.apache.hive.service.cli.session.HiveSession; + +/** + * GetPrimaryKeysOperation. + * + */ +public class GetPrimaryKeysOperation extends MetadataOperation { +/** +TABLE_CAT String => table catalog (may be null) +TABLE_SCHEM String => table schema (may be null) +TABLE_NAME String => table name +COLUMN_NAME String => column name +KEY_SEQ short => sequence number within primary key( a value of 1 represents the first column of the primary key, a value of 2 would represent the second column within the primary key). +PK_NAME String => primary key name (may be null) + */ + private static final TableSchema RESULT_SET_SCHEMA = new TableSchema() + .addPrimitiveColumn("TABLE_CAT", Type.STRING_TYPE, + "Table catalog (may be null)") + .addPrimitiveColumn("TABLE_SCHEM", Type.STRING_TYPE, + "Table schema (may be null)") + .addPrimitiveColumn("TABLE_NAME", Type.STRING_TYPE, + "Table name") + .addPrimitiveColumn("COLUMN_NAME", Type.STRING_TYPE, + "Column name") + .addPrimitiveColumn("KEQ_SEQ", Type.INT_TYPE, + "Sequence number within primary key") + .addPrimitiveColumn("PK_NAME", Type.STRING_TYPE, + "Primary key name (may be null)"); + + private final String catalogName; + private final String schemaName; + private final String tableName; + + private final RowSet rowSet; + + public GetPrimaryKeysOperation(HiveSession parentSession, + String catalogName, String schemaName, String tableName) { + super(parentSession, OperationType.GET_FUNCTIONS); + this.catalogName = catalogName; + this.schemaName = schemaName; + this.tableName = tableName; + this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); + } + + @Override + public void runInternal() throws HiveSQLException { + setState(OperationState.RUNNING); + try { + IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); + List pks = metastoreClient.getPrimaryKeys(schemaName, tableName); + if (pks == null) { + return; + } + for (SQLPrimaryKey pk : pks) { + rowSet.addRow(new Object[] {catalogName, pk.getTable_schem(), + pk.getTable_name(), pk.getColumn_name(), pk.getKey_seq(), pk.getPk_name()}); + } + setState(OperationState.FINISHED); + } catch (Exception e) { + setState(OperationState.ERROR); + throw new HiveSQLException(e); + } + } + + + /* (non-Javadoc) + * @see org.apache.hive.service.cli.Operation#getResultSetSchema() + */ + @Override + public TableSchema getResultSetSchema() throws HiveSQLException { + assertState(OperationState.FINISHED); + return RESULT_SET_SCHEMA; + } + + /* (non-Javadoc) + * @see org.apache.hive.service.cli.Operation#getNextRowSet(org.apache.hive.service.cli.FetchOrientation, long) + */ + @Override + public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { + assertState(OperationState.FINISHED); + validateDefaultFetchOrientation(orientation); + if (orientation.equals(FetchOrientation.FETCH_FIRST)) { + rowSet.setStartOffset(0); + } + return rowSet.extractSubset((int)maxRows); + } +} diff --git a/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java b/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java index 56a9c18..8bb7c3b 100644 --- a/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java +++ b/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java @@ -169,6 +169,25 @@ public GetFunctionsOperation newGetFunctionsOperation(HiveSession parentSession, return operation; } + public GetPrimaryKeysOperation newGetPrimaryKeysOperation(HiveSession parentSession, + String catalogName, String schemaName, String tableName) { + GetPrimaryKeysOperation operation = new GetPrimaryKeysOperation(parentSession, + catalogName, schemaName, tableName); + addOperation(operation); + return operation; + } + + public GetCrossReferenceOperation newGetCrossReferenceOperation( + HiveSession session, String primaryCatalog, String primarySchema, + String primaryTable, String foreignCatalog, String foreignSchema, + String foreignTable) { + GetCrossReferenceOperation operation = new GetCrossReferenceOperation(session, + primaryCatalog, primarySchema, primaryTable, foreignCatalog, foreignSchema, + foreignTable); + addOperation(operation); + return operation; + } + public Operation getOperation(OperationHandle operationHandle) throws HiveSQLException { Operation operation = getOperationInternal(operationHandle); if (operation == null) { diff --git a/service/src/java/org/apache/hive/service/cli/session/HiveSession.java b/service/src/java/org/apache/hive/service/cli/session/HiveSession.java index 4f4e92d..9ea643b 100644 --- a/service/src/java/org/apache/hive/service/cli/session/HiveSession.java +++ b/service/src/java/org/apache/hive/service/cli/session/HiveSession.java @@ -136,6 +136,34 @@ OperationHandle getFunctions(String catalogName, String schemaName, String functionName) throws HiveSQLException; /** + * getPrimaryKeys operation handler + * @param catalog + * @param schema + * @param table + * @return + * @throws HiveSQLException + */ + OperationHandle getPrimaryKeys(String catalog, String schema, String table) + throws HiveSQLException; + + + /** + * getCrossReference operation handler + * @param primaryCatalog + * @param primarySchema + * @param primaryTable + * @param foreignCatalog + * @param foreignSchema + * @param foreignTable + * @return + * @throws HiveSQLException + */ + OperationHandle getCrossReference(String primaryCatalog, + String primarySchema, String primaryTable, String foreignCatalog, + String foreignSchema, String foreignTable) + throws HiveSQLException; + + /** * close the session * @throws HiveSQLException */ diff --git a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java index 80a1844..f7c12dc 100644 --- a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java +++ b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java @@ -62,7 +62,9 @@ import org.apache.hive.service.cli.operation.ExecuteStatementOperation; import org.apache.hive.service.cli.operation.GetCatalogsOperation; import org.apache.hive.service.cli.operation.GetColumnsOperation; +import org.apache.hive.service.cli.operation.GetCrossReferenceOperation; import org.apache.hive.service.cli.operation.GetFunctionsOperation; +import org.apache.hive.service.cli.operation.GetPrimaryKeysOperation; import org.apache.hive.service.cli.operation.GetSchemasOperation; import org.apache.hive.service.cli.operation.GetTableTypesOperation; import org.apache.hive.service.cli.operation.GetTypeInfoOperation; @@ -836,4 +838,49 @@ public void renewDelegationToken(HiveAuthFactory authFactory, String tokenStr) private String getUserFromToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException { return authFactory.getUserFromToken(tokenStr); } + + @Override + public OperationHandle getPrimaryKeys(String catalog, String schema, + String table) throws HiveSQLException { + acquire(true); + + OperationManager operationManager = getOperationManager(); + GetPrimaryKeysOperation operation = operationManager + .newGetPrimaryKeysOperation(getSession(), catalog, schema, table); + OperationHandle opHandle = operation.getHandle(); + try { + operation.run(); + addOpHandle(opHandle); + return opHandle; + } catch (HiveSQLException e) { + operationManager.closeOperation(opHandle); + throw e; + } finally { + release(true); + } +} + + @Override + public OperationHandle getCrossReference(String primaryCatalog, + String primarySchema, String primaryTable, String foreignCatalog, + String foreignSchema, String foreignTable) throws HiveSQLException { + acquire(true); + + OperationManager operationManager = getOperationManager(); + GetCrossReferenceOperation operation = operationManager + .newGetCrossReferenceOperation(getSession(), primaryCatalog, + primarySchema, primaryTable, foreignCatalog, + foreignSchema, foreignTable); + OperationHandle opHandle = operation.getHandle(); + try { + operation.run(); + addOpHandle(opHandle); + return opHandle; + } catch (HiveSQLException e) { + operationManager.closeOperation(opHandle); + throw e; + } finally { + release(true); + } +} } diff --git a/service/src/java/org/apache/hive/service/cli/thrift/RetryingThriftCLIServiceClient.java b/service/src/java/org/apache/hive/service/cli/thrift/RetryingThriftCLIServiceClient.java index 14191e5..0867ff5 100644 --- a/service/src/java/org/apache/hive/service/cli/thrift/RetryingThriftCLIServiceClient.java +++ b/service/src/java/org/apache/hive/service/cli/thrift/RetryingThriftCLIServiceClient.java @@ -207,6 +207,22 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio public void closeTransport() { tTransport.close(); } + + @Override + public OperationHandle getPrimaryKeys(SessionHandle sessionHandle, + String catalog, String schema, String table) + throws HiveSQLException { + return cliService.getPrimaryKeys(sessionHandle, catalog, schema, table); + } + + @Override + public OperationHandle getCrossReference(SessionHandle sessionHandle, + String primaryCatalog, String primarySchema, String primaryTable, + String foreignCatalog, String foreignSchema, String foreignTable) + throws HiveSQLException { + return cliService.getCrossReference(sessionHandle, primaryCatalog, primarySchema, + primaryTable, foreignCatalog, foreignSchema, foreignTable); + } } protected RetryingThriftCLIServiceClient(HiveConf conf) { diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java index 62fcde5..19a84d8 100644 --- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java +++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java @@ -70,6 +70,8 @@ import org.apache.hive.service.rpc.thrift.TGetCatalogsResp; import org.apache.hive.service.rpc.thrift.TGetColumnsReq; import org.apache.hive.service.rpc.thrift.TGetColumnsResp; +import org.apache.hive.service.rpc.thrift.TGetCrossReferenceReq; +import org.apache.hive.service.rpc.thrift.TGetCrossReferenceResp; import org.apache.hive.service.rpc.thrift.TGetDelegationTokenReq; import org.apache.hive.service.rpc.thrift.TGetDelegationTokenResp; import org.apache.hive.service.rpc.thrift.TGetFunctionsReq; @@ -78,6 +80,8 @@ import org.apache.hive.service.rpc.thrift.TGetInfoResp; import org.apache.hive.service.rpc.thrift.TGetOperationStatusReq; import org.apache.hive.service.rpc.thrift.TGetOperationStatusResp; +import org.apache.hive.service.rpc.thrift.TGetPrimaryKeysReq; +import org.apache.hive.service.rpc.thrift.TGetPrimaryKeysResp; import org.apache.hive.service.rpc.thrift.TGetResultSetMetadataReq; import org.apache.hive.service.rpc.thrift.TGetResultSetMetadataResp; import org.apache.hive.service.rpc.thrift.TGetSchemasReq; @@ -756,6 +760,41 @@ public TFetchResultsResp FetchResults(TFetchResultsReq req) throws TException { } @Override + public TGetPrimaryKeysResp GetPrimaryKeys(TGetPrimaryKeysReq req) + throws TException { + TGetPrimaryKeysResp resp = new TGetPrimaryKeysResp(); + try { + OperationHandle opHandle = cliService.getPrimaryKeys( + new SessionHandle(req.getSessionHandle()), req.getCatalogName(), + req.getSchemaName(), req.getTableName()); + resp.setOperationHandle(opHandle.toTOperationHandle()); + resp.setStatus(OK_STATUS); + } catch (Exception e) { + LOG.warn("Error getting functions: ", e); + resp.setStatus(HiveSQLException.toTStatus(e)); + } + return resp; + } + + @Override + public TGetCrossReferenceResp GetCrossReference(TGetCrossReferenceReq req) + throws TException { + TGetCrossReferenceResp resp = new TGetCrossReferenceResp(); + try { + OperationHandle opHandle = cliService.getCrossReference( + new SessionHandle(req.getSessionHandle()), req.getParentCatalogName(), + req.getParentSchemaName(), req.getParentTableName(), + req.getForeignCatalogName(), req.getForeignSchemaName(), req.getForeignTableName()); + resp.setOperationHandle(opHandle.toTOperationHandle()); + resp.setStatus(OK_STATUS); + } catch (Exception e) { + LOG.warn("Error getting functions: ", e); + resp.setStatus(HiveSQLException.toTStatus(e)); + } + return resp; + } + + @Override public abstract void run(); /** diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java index ccce6dc..098aea6 100644 --- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java +++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java @@ -52,6 +52,8 @@ import org.apache.hive.service.rpc.thrift.TGetCatalogsResp; import org.apache.hive.service.rpc.thrift.TGetColumnsReq; import org.apache.hive.service.rpc.thrift.TGetColumnsResp; +import org.apache.hive.service.rpc.thrift.TGetCrossReferenceReq; +import org.apache.hive.service.rpc.thrift.TGetCrossReferenceResp; import org.apache.hive.service.rpc.thrift.TGetDelegationTokenReq; import org.apache.hive.service.rpc.thrift.TGetDelegationTokenResp; import org.apache.hive.service.rpc.thrift.TGetFunctionsReq; @@ -60,6 +62,8 @@ import org.apache.hive.service.rpc.thrift.TGetInfoResp; import org.apache.hive.service.rpc.thrift.TGetOperationStatusReq; import org.apache.hive.service.rpc.thrift.TGetOperationStatusResp; +import org.apache.hive.service.rpc.thrift.TGetPrimaryKeysReq; +import org.apache.hive.service.rpc.thrift.TGetPrimaryKeysResp; import org.apache.hive.service.rpc.thrift.TGetResultSetMetadataReq; import org.apache.hive.service.rpc.thrift.TGetResultSetMetadataResp; import org.apache.hive.service.rpc.thrift.TGetSchemasReq; @@ -492,4 +496,47 @@ public void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory au throw new HiveSQLException(e); } } + + @Override + public OperationHandle getPrimaryKeys(SessionHandle sessionHandle, + String catalog, String schema, String table) throws HiveSQLException { + try { + TGetPrimaryKeysReq req = new TGetPrimaryKeysReq(sessionHandle.toTSessionHandle()); + req.setCatalogName(catalog); + req.setSchemaName(schema); + req.setTableName(table); + TGetPrimaryKeysResp resp = cliService.GetPrimaryKeys(req); + checkStatus(resp.getStatus()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); + } catch (HiveSQLException e) { + throw e; + } catch (Exception e) { + throw new HiveSQLException(e); + } + } + + @Override + public OperationHandle getCrossReference(SessionHandle sessionHandle, + String primaryCatalog, String primarySchema, String primaryTable, + String foreignCatalog, String foreignSchema, String foreignTable) + throws HiveSQLException { + try { + TGetCrossReferenceReq req = new TGetCrossReferenceReq(sessionHandle.toTSessionHandle()); + req.setParentCatalogName(primaryCatalog); + req.setParentSchemaName(primarySchema); + req.setParentTableName(primaryTable); + req.setForeignCatalogName(foreignCatalog); + req.setForeignSchemaName(foreignSchema); + req.setForeignTableName(foreignTable); + TGetCrossReferenceResp resp = cliService.GetCrossReference(req); + checkStatus(resp.getStatus()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); + } catch (HiveSQLException e) { + throw e; + } catch (Exception e) { + throw new HiveSQLException(e); + } + } }