diff --git itests/hive-unit-hadoop2/src/test/java/org/apache/hive/TestThriftGetJobIDs.java itests/hive-unit-hadoop2/src/test/java/org/apache/hive/TestThriftGetJobIDs.java new file mode 100644 index 0000000000000000000000000000000000000000..27225c14cd860d383d2f84acf900106f3baa5859 --- /dev/null +++ itests/hive-unit-hadoop2/src/test/java/org/apache/hive/TestThriftGetJobIDs.java @@ -0,0 +1,165 @@ +/** + * 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; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; +import org.apache.hadoop.hive.ql.thrift.JobIDSet.ExecutionEngine; +import org.apache.hive.jdbc.miniHS2.MiniHS2; +import org.apache.hive.service.cli.CLIServiceClient; +import org.apache.hive.service.cli.HiveSQLException; +import org.apache.hive.service.cli.OperationHandle; +import org.apache.hive.service.cli.OperationState; +import org.apache.hive.service.cli.OperationStatus; +import org.apache.hive.service.cli.SessionHandle; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestThriftGetJobIDs { + private static final Log LOG = LogFactory.getLog(TestThriftGetJobIDs.class); + private static MiniHS2 miniHS2 = null; + private static HiveConf hiveConf = new HiveConf(); + private static Map confOverlay; + private static CLIServiceClient client; + private static SessionHandle sessHandle; + private static Path dataFilePath; + + @BeforeClass + public static void beforeClass() throws Exception { + miniHS2 = new MiniHS2.Builder() + .withMiniMR() + .withConf(hiveConf).build(); + confOverlay = new HashMap(); + confOverlay.put(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false"); + confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS.varname, "false"); + confOverlay.put(HiveConf.ConfVars.HIVE_LOCK_MANAGER.varname, + "org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager"); + miniHS2.start(new HashMap()); + + String dataFileDir = hiveConf.get("test.data.files").replace('\\', '/') + .replace("c:", ""); + dataFilePath = new Path(dataFileDir, "kv1.txt"); + + } + + @AfterClass + public static void afterClass() throws Exception { + if (miniHS2 != null && miniHS2.isStarted()) { + miniHS2.stop(); + } + } + + @Before + public void beforeTest() throws Exception { + client = miniHS2.getServiceClient(); + sessHandle = client.openSession("anonymous", + "anonymous", confOverlay); + String queryString = "DROP TABLE IF EXISTS TEST_GET_JOBIDS"; + client.executeStatement(sessHandle, queryString, confOverlay); + assertNotNull("Session handle should not be null", sessHandle); + queryString = "CREATE TABLE TEST_GET_JOBIDS(under_col int, value string)"; + client.executeStatement(sessHandle, queryString, confOverlay); + client.executeStatement(sessHandle, "LOAD DATA LOCAL INPATH '" + + dataFilePath.toString() + "' INTO TABLE TEST_GET_JOBIDS", + confOverlay); + } + + @After + public void afterTest() throws Exception { + String queryString = "DROP TABLE IF EXISTS TEST_GET_JOBIDS"; + client.executeStatement(sessHandle, queryString, confOverlay); + } + + @Test + public void testGetJobIDsFail() throws Exception { + String queryString = "SELECT * FROM TEST_GET_JOBIDS"; + OperationHandle opHandle = client.executeStatementAsync(sessHandle, + queryString, confOverlay); + assertNotNull(opHandle); + // Poll for jobIDs but none should be available + pollForJobIDs(client, opHandle, false); + } + + @Test + public void testGetJobIDsPass() throws Exception { + // Execute an MR query + String queryString = "SELECT count(*) FROM TEST_GET_JOBIDS"; + OperationHandle opHandle = client.executeStatementAsync(sessHandle, + queryString, confOverlay); + assertNotNull(opHandle); + // Poll on jobIDs until one is available + pollForJobIDs(client, opHandle, true); + } + + private void pollForJobIDs(CLIServiceClient client, OperationHandle opHandle, + boolean jobIDsExpected) throws Exception { + boolean isQueryRunning = true; + long pollTimeout = System.currentTimeMillis() + 100000; + boolean jobIDsFound = false; + while (isQueryRunning) { + // Break if polling times out + if (System.currentTimeMillis() > pollTimeout) { + LOG.info("Polling timed out"); + break; + } + + try { + JobIDSet jobIDSet = client.getJobIDs(opHandle); + if (!jobIDSet.getIds().isEmpty()) { + jobIDsFound = true; + for (String id : jobIDSet.getIds()) { + assertNotNull("JobID is null", id); + } + assertEquals("MapReduce execution engine expected", + jobIDSet.getExecutionEngine(), + ExecutionEngine.MAPREDUCE); + break; + } + } catch (HiveSQLException e) { + // Ignore and keep trying. Operation may not have started running. + } + + OperationStatus opStatus = client.getOperationStatus(opHandle); + assertNotNull(opStatus); + OperationState state = opStatus.getState(); + LOG.info("Current state: " + state); + + if (state == OperationState.CANCELED || + state == OperationState.CLOSED || + state == OperationState.FINISHED || + state == OperationState.ERROR) { + isQueryRunning = false; + } + Thread.sleep(10); + } + assertEquals(jobIDsFound, jobIDsExpected); + } +} \ No newline at end of file diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote old mode 100644 new mode 100755 diff --git ql/src/java/org/apache/hadoop/hive/ql/Driver.java ql/src/java/org/apache/hadoop/hive/ql/Driver.java index e25450531a71ef4ae4c6d9ea1788e618189a17cb..9cffe4c82a4d1487d23c335881aa79648207f7bb 100644 --- ql/src/java/org/apache/hadoop/hive/ql/Driver.java +++ ql/src/java/org/apache/hadoop/hive/ql/Driver.java @@ -111,6 +111,7 @@ import org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject.HivePrivilegeObjectType; import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hadoop.hive.ql.session.SessionState.LogHelper; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hadoop.hive.serde2.ByteStream; import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.mapred.ClusterStatus; @@ -1613,6 +1614,16 @@ public boolean isFetchingTable() { return plan != null && plan.getFetchTask() != null; } + public JobIDSet getJobIDs() { + if (driverCxt != null) { + return driverCxt.getJobIDs(); + } else { + LOG.error("Could not retrieve job IDs. Either operation has finished running " + + "or has not started running yet."); + return null; + } + } + @SuppressWarnings("unchecked") public boolean getResults(List res) throws IOException, CommandNeedRetryException { if (destroyed) { @@ -1692,7 +1703,6 @@ public void setTryCount(int tryCount) { this.tryCount = tryCount; } - public int close() { try { if (plan != null) { diff --git ql/src/java/org/apache/hadoop/hive/ql/DriverContext.java ql/src/java/org/apache/hadoop/hive/ql/DriverContext.java index c7d3b6652f89cf7b6507f35176962ff3287d112d..8453d68165827b60f70cece672b2631f424c7306 100644 --- ql/src/java/org/apache/hadoop/hive/ql/DriverContext.java +++ ql/src/java/org/apache/hadoop/hive/ql/DriverContext.java @@ -26,6 +26,7 @@ import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.exec.TaskRunner; import org.apache.hadoop.hive.ql.exec.mr.MapRedTask; +import org.apache.hadoop.hive.ql.exec.tez.TezTask; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.plan.MapWork; import org.apache.hadoop.hive.ql.plan.ReduceWork; @@ -43,6 +44,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hive.ql.session.SessionState; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; +import org.apache.hadoop.hive.ql.thrift.JobIDSet.ExecutionEngine; /** * DriverContext. @@ -100,6 +103,36 @@ public synchronized void launching(TaskRunner runner) throws HiveException { return null; } + public JobIDSet getJobIDs() { + LOG.debug("Looking up job IDs for " + ctx.getCmd()); + JobIDSet jobIDSet = null; + List jobIDs = new ArrayList(); + ExecutionEngine engine = null; + for (TaskRunner runner : running) { + if (runner.isRunning()) { + Task task = runner.getTask(); + try { + if (task instanceof MapRedTask) { + String jobID = ((MapRedTask) (task)).getRunningJob().getID().toString(); + if (jobID != null) { + jobIDs.add(jobID); + engine = ExecutionEngine.MAPREDUCE; + } + } else if(task instanceof TezTask) { + // TODO: Add Tez job IDs + } + } catch (Exception e) { + console.printError("Exception fetching job IDs for " + task.getId() + ": " + e); + } + } + } + if (!jobIDs.isEmpty()) { + jobIDSet = new JobIDSet(engine, jobIDs); + } + + return jobIDSet; + } + /** * Polls running tasks to see if a task has ended. * @@ -138,7 +171,7 @@ public synchronized void shutdown() { try { task.shutdown(); } catch (Exception e) { - console.printError("Exception on shutting down task " + task.getId() + ": " + e); + console.printError("Exception shutting down task " + task.getId() + ": " + e); } Thread thread = runner.getRunner(); if (thread != null) { diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java index 4e3df75c614fe7232e670201f2560c7ccd1db41c..2292e8ea29991d65247ae13c65793d43e318748c 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java @@ -596,6 +596,10 @@ public boolean reduceDone() { return this.jobExecHelper.reduceDone(); } + public RunningJob getRunningJob() { + return rj; + } + private static void printUsage() { System.err.println("ExecDriver -plan [-jobconffile ]" + "[-files [,] ...]"); diff --git ql/src/java/org/apache/hadoop/hive/ql/thrift/JobIDSet.java ql/src/java/org/apache/hadoop/hive/ql/thrift/JobIDSet.java new file mode 100644 index 0000000000000000000000000000000000000000..958bfeb4a3dfa1dbf78138325bdb15cc539ca6c2 --- /dev/null +++ ql/src/java/org/apache/hadoop/hive/ql/thrift/JobIDSet.java @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.ql.thrift; + +import java.util.List; + +/** + * JobIDSet + * Contains job IDs to return to Thrift client + */ +public class JobIDSet { + + public enum ExecutionEngine { + MAPREDUCE, + TEZ; + } + private List ids; + private ExecutionEngine executionEngine; + + public JobIDSet() {} + + public JobIDSet(ExecutionEngine executionEngine, List ids) { + this.executionEngine = executionEngine; + this.ids = ids; + } + + public ExecutionEngine getExecutionEngine() { + return executionEngine; + } + + public void setExecutionEngine(ExecutionEngine executionEngine) { + this.executionEngine = executionEngine; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } +} \ No newline at end of file diff --git service/if/TCLIService.thrift service/if/TCLIService.thrift index 4024bb3f412440fb7533f2e2d8ebc9a7cdc0776d..a929af37de0bd7c4658022ce799bf5609cdf3d42 100644 --- service/if/TCLIService.thrift +++ service/if/TCLIService.thrift @@ -1123,6 +1123,28 @@ struct TRenewDelegationTokenResp { 1: required TStatus status } +enum TExecutionEngine { + MAPREDUCE +} + +// GetJobIDs() +// +// Fetch job ids from the server corresponding to +// a particular OperationHandle. +struct TGetJobIDsReq { + // Operation whose job ids are requested + 1: required TOperationHandle operationHandle +} + +struct TGetJobIDsResp { + 1: required TStatus status + + 2: required TExecutionEngine executionEngine + + 3: required list jobids +} + + service TCLIService { TOpenSessionResp OpenSession(1:TOpenSessionReq req); @@ -1162,4 +1184,6 @@ service TCLIService { TCancelDelegationTokenResp CancelDelegationToken(1:TCancelDelegationTokenReq req); TRenewDelegationTokenResp RenewDelegationToken(1:TRenewDelegationTokenReq req); + + TGetJobIDsResp GetJobIDs(1:TGetJobIDsReq req); } diff --git service/src/gen/thrift/gen-cpp/TCLIService.cpp service/src/gen/thrift/gen-cpp/TCLIService.cpp index 209ce63ae1ffd593de81e8e0a8e73218afe3cd79..2423317d233ae0b42b9e35be2df500233361d3af 100644 --- service/src/gen/thrift/gen-cpp/TCLIService.cpp +++ service/src/gen/thrift/gen-cpp/TCLIService.cpp @@ -3086,6 +3086,168 @@ uint32_t TCLIService_RenewDelegationToken_presult::read(::apache::thrift::protoc return xfer; } +uint32_t TCLIService_GetJobIDs_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->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_GetJobIDs_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TCLIService_GetJobIDs_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; +} + +uint32_t TCLIService_GetJobIDs_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TCLIService_GetJobIDs_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; +} + +uint32_t TCLIService_GetJobIDs_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_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_GetJobIDs_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("TCLIService_GetJobIDs_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; +} + +uint32_t TCLIService_GetJobIDs_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_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; +} + void TCLIServiceClient::OpenSession(TOpenSessionResp& _return, const TOpenSessionReq& req) { send_OpenSession(req); @@ -4188,6 +4350,64 @@ void TCLIServiceClient::recv_RenewDelegationToken(TRenewDelegationTokenResp& _re throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "RenewDelegationToken failed: unknown result"); } +void TCLIServiceClient::GetJobIDs(TGetJobIDsResp& _return, const TGetJobIDsReq& req) +{ + send_GetJobIDs(req); + recv_GetJobIDs(_return); +} + +void TCLIServiceClient::send_GetJobIDs(const TGetJobIDsReq& req) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("GetJobIDs", ::apache::thrift::protocol::T_CALL, cseqid); + + TCLIService_GetJobIDs_pargs args; + args.req = &req; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void TCLIServiceClient::recv_GetJobIDs(TGetJobIDsResp& _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("GetJobIDs") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + TCLIService_GetJobIDs_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, "GetJobIDs failed: unknown result"); +} + bool TCLIServiceProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { ProcessMap::iterator pfn; pfn = processMap_.find(fname); @@ -5233,6 +5453,60 @@ void TCLIServiceProcessor::process_RenewDelegationToken(int32_t seqid, ::apache: } } +void TCLIServiceProcessor::process_GetJobIDs(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.GetJobIDs", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "TCLIService.GetJobIDs"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "TCLIService.GetJobIDs"); + } + + TCLIService_GetJobIDs_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "TCLIService.GetJobIDs", bytes); + } + + TCLIService_GetJobIDs_result result; + try { + iface_->GetJobIDs(result.success, args.req); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "TCLIService.GetJobIDs"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("GetJobIDs", ::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.GetJobIDs"); + } + + oprot->writeMessageBegin("GetJobIDs", ::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.GetJobIDs", bytes); + } +} + ::boost::shared_ptr< ::apache::thrift::TProcessor > TCLIServiceProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< TCLIServiceIfFactory > cleanup(handlerFactory_); ::boost::shared_ptr< TCLIServiceIf > handler(handlerFactory_->getHandler(connInfo), cleanup); diff --git service/src/gen/thrift/gen-cpp/TCLIService.h service/src/gen/thrift/gen-cpp/TCLIService.h index 030475b25188c5d2494da4de0bd6edc1ae807eca..00dea01c44347218e2af924c8fde703dec56f858 100644 --- service/src/gen/thrift/gen-cpp/TCLIService.h +++ service/src/gen/thrift/gen-cpp/TCLIService.h @@ -34,6 +34,7 @@ class TCLIServiceIf { virtual void GetDelegationToken(TGetDelegationTokenResp& _return, const TGetDelegationTokenReq& req) = 0; virtual void CancelDelegationToken(TCancelDelegationTokenResp& _return, const TCancelDelegationTokenReq& req) = 0; virtual void RenewDelegationToken(TRenewDelegationTokenResp& _return, const TRenewDelegationTokenReq& req) = 0; + virtual void GetJobIDs(TGetJobIDsResp& _return, const TGetJobIDsReq& req) = 0; }; class TCLIServiceIfFactory { @@ -120,6 +121,9 @@ class TCLIServiceNull : virtual public TCLIServiceIf { void RenewDelegationToken(TRenewDelegationTokenResp& /* _return */, const TRenewDelegationTokenReq& /* req */) { return; } + void GetJobIDs(TGetJobIDsResp& /* _return */, const TGetJobIDsReq& /* req */) { + return; + } }; typedef struct _TCLIService_OpenSession_args__isset { @@ -2174,6 +2178,114 @@ class TCLIService_RenewDelegationToken_presult { }; +typedef struct _TCLIService_GetJobIDs_args__isset { + _TCLIService_GetJobIDs_args__isset() : req(false) {} + bool req; +} _TCLIService_GetJobIDs_args__isset; + +class TCLIService_GetJobIDs_args { + public: + + TCLIService_GetJobIDs_args() { + } + + virtual ~TCLIService_GetJobIDs_args() throw() {} + + TGetJobIDsReq req; + + _TCLIService_GetJobIDs_args__isset __isset; + + void __set_req(const TGetJobIDsReq& val) { + req = val; + } + + bool operator == (const TCLIService_GetJobIDs_args & rhs) const + { + if (!(req == rhs.req)) + return false; + return true; + } + bool operator != (const TCLIService_GetJobIDs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCLIService_GetJobIDs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class TCLIService_GetJobIDs_pargs { + public: + + + virtual ~TCLIService_GetJobIDs_pargs() throw() {} + + const TGetJobIDsReq* req; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TCLIService_GetJobIDs_result__isset { + _TCLIService_GetJobIDs_result__isset() : success(false) {} + bool success; +} _TCLIService_GetJobIDs_result__isset; + +class TCLIService_GetJobIDs_result { + public: + + TCLIService_GetJobIDs_result() { + } + + virtual ~TCLIService_GetJobIDs_result() throw() {} + + TGetJobIDsResp success; + + _TCLIService_GetJobIDs_result__isset __isset; + + void __set_success(const TGetJobIDsResp& val) { + success = val; + } + + bool operator == (const TCLIService_GetJobIDs_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const TCLIService_GetJobIDs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCLIService_GetJobIDs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TCLIService_GetJobIDs_presult__isset { + _TCLIService_GetJobIDs_presult__isset() : success(false) {} + bool success; +} _TCLIService_GetJobIDs_presult__isset; + +class TCLIService_GetJobIDs_presult { + public: + + + virtual ~TCLIService_GetJobIDs_presult() throw() {} + + TGetJobIDsResp* success; + + _TCLIService_GetJobIDs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + class TCLIServiceClient : virtual public TCLIServiceIf { public: TCLIServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : @@ -2251,6 +2363,9 @@ class TCLIServiceClient : virtual public TCLIServiceIf { void RenewDelegationToken(TRenewDelegationTokenResp& _return, const TRenewDelegationTokenReq& req); void send_RenewDelegationToken(const TRenewDelegationTokenReq& req); void recv_RenewDelegationToken(TRenewDelegationTokenResp& _return); + void GetJobIDs(TGetJobIDsResp& _return, const TGetJobIDsReq& req); + void send_GetJobIDs(const TGetJobIDsReq& req); + void recv_GetJobIDs(TGetJobIDsResp& _return); protected: boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; @@ -2285,6 +2400,7 @@ class TCLIServiceProcessor : public ::apache::thrift::TDispatchProcessor { void process_GetDelegationToken(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_CancelDelegationToken(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_RenewDelegationToken(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_GetJobIDs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: TCLIServiceProcessor(boost::shared_ptr iface) : iface_(iface) { @@ -2307,6 +2423,7 @@ class TCLIServiceProcessor : public ::apache::thrift::TDispatchProcessor { processMap_["GetDelegationToken"] = &TCLIServiceProcessor::process_GetDelegationToken; processMap_["CancelDelegationToken"] = &TCLIServiceProcessor::process_CancelDelegationToken; processMap_["RenewDelegationToken"] = &TCLIServiceProcessor::process_RenewDelegationToken; + processMap_["GetJobIDs"] = &TCLIServiceProcessor::process_GetJobIDs; } virtual ~TCLIServiceProcessor() {} @@ -2525,6 +2642,16 @@ class TCLIServiceMultiface : virtual public TCLIServiceIf { return; } + void GetJobIDs(TGetJobIDsResp& _return, const TGetJobIDsReq& req) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->GetJobIDs(_return, req); + } + ifaces_[i]->GetJobIDs(_return, req); + return; + } + }; }}}}} // namespace diff --git service/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp service/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp index 988bb4c11ddb717f585e0ba2fb4773ec5fff77e6..585cc97cb865609a2a421c7507db8636b811b41c 100644 --- service/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp +++ service/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp @@ -117,6 +117,11 @@ class TCLIServiceHandler : virtual public TCLIServiceIf { printf("RenewDelegationToken\n"); } + void GetJobIDs(TGetJobIDsResp& _return, const TGetJobIDsReq& req) { + // Your implementation goes here + printf("GetJobIDs\n"); + } + }; int main(int argc, char **argv) { diff --git service/src/gen/thrift/gen-cpp/TCLIService_types.cpp service/src/gen/thrift/gen-cpp/TCLIService_types.cpp index 326d25b8b7d814f7bbdfab7dde805be4834493dc..256f8736cb5ce04ed06098ad41a54fbf0c987c13 100644 --- service/src/gen/thrift/gen-cpp/TCLIService_types.cpp +++ service/src/gen/thrift/gen-cpp/TCLIService_types.cpp @@ -256,6 +256,14 @@ const char* _kTFetchOrientationNames[] = { }; const std::map _TFetchOrientation_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(6, _kTFetchOrientationValues, _kTFetchOrientationNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); +int _kTExecutionEngineValues[] = { + TExecutionEngine::MAPREDUCE +}; +const char* _kTExecutionEngineNames[] = { + "MAPREDUCE" +}; +const std::map _TExecutionEngine_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(1, _kTExecutionEngineValues, _kTExecutionEngineNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + const char* TTypeQualifierValue::ascii_fingerprint = "A7801670116150C65ACA43E6F679BA79"; const uint8_t TTypeQualifierValue::binary_fingerprint[16] = {0xA7,0x80,0x16,0x70,0x11,0x61,0x50,0xC6,0x5A,0xCA,0x43,0xE6,0xF6,0x79,0xBA,0x79}; @@ -6806,4 +6814,186 @@ void swap(TRenewDelegationTokenResp &a, TRenewDelegationTokenResp &b) { swap(a.status, b.status); } +const char* TGetJobIDsReq::ascii_fingerprint = "414FA38522AE6B9CEC1438B56CA1DE5A"; +const uint8_t TGetJobIDsReq::binary_fingerprint[16] = {0x41,0x4F,0xA3,0x85,0x22,0xAE,0x6B,0x9C,0xEC,0x14,0x38,0xB5,0x6C,0xA1,0xDE,0x5A}; + +uint32_t TGetJobIDsReq::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_operationHandle = 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->operationHandle.read(iprot); + isset_operationHandle = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_operationHandle) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TGetJobIDsReq::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TGetJobIDsReq"); + + xfer += oprot->writeFieldBegin("operationHandle", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->operationHandle.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TGetJobIDsReq &a, TGetJobIDsReq &b) { + using ::std::swap; + swap(a.operationHandle, b.operationHandle); +} + +const char* TGetJobIDsResp::ascii_fingerprint = "19D0E199C6FCA381189B03E1959DCAB5"; +const uint8_t TGetJobIDsResp::binary_fingerprint[16] = {0x19,0xD0,0xE1,0x99,0xC6,0xFC,0xA3,0x81,0x18,0x9B,0x03,0xE1,0x95,0x9D,0xCA,0xB5}; + +uint32_t TGetJobIDsResp::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_status = false; + bool isset_executionEngine = false; + bool isset_jobids = 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_I32) { + int32_t ecast146; + xfer += iprot->readI32(ecast146); + this->executionEngine = (TExecutionEngine::type)ecast146; + isset_executionEngine = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->jobids.clear(); + uint32_t _size147; + ::apache::thrift::protocol::TType _etype150; + xfer += iprot->readListBegin(_etype150, _size147); + this->jobids.resize(_size147); + uint32_t _i151; + for (_i151 = 0; _i151 < _size147; ++_i151) + { + xfer += iprot->readString(this->jobids[_i151]); + } + xfer += iprot->readListEnd(); + } + isset_jobids = 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); + if (!isset_executionEngine) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_jobids) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TGetJobIDsResp::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TGetJobIDsResp"); + + xfer += oprot->writeFieldBegin("status", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->status.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("executionEngine", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32((int32_t)this->executionEngine); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("jobids", ::apache::thrift::protocol::T_LIST, 3); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->jobids.size())); + std::vector ::const_iterator _iter152; + for (_iter152 = this->jobids.begin(); _iter152 != this->jobids.end(); ++_iter152) + { + xfer += oprot->writeString((*_iter152)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TGetJobIDsResp &a, TGetJobIDsResp &b) { + using ::std::swap; + swap(a.status, b.status); + swap(a.executionEngine, b.executionEngine); + swap(a.jobids, b.jobids); +} + }}}}} // namespace diff --git service/src/gen/thrift/gen-cpp/TCLIService_types.h service/src/gen/thrift/gen-cpp/TCLIService_types.h index f32dc3c90caedba86d943a9295a2f246a7b0ec90..ac2fa8e9e57e29a8ba9a1d3c164558a0adce95ab 100644 --- service/src/gen/thrift/gen-cpp/TCLIService_types.h +++ service/src/gen/thrift/gen-cpp/TCLIService_types.h @@ -167,6 +167,14 @@ struct TFetchOrientation { extern const std::map _TFetchOrientation_VALUES_TO_NAMES; +struct TExecutionEngine { + enum type { + MAPREDUCE = 0 + }; +}; + +extern const std::map _TExecutionEngine_VALUES_TO_NAMES; + typedef int32_t TTypeEntryPtr; typedef std::string TIdentifier; @@ -4001,6 +4009,94 @@ class TRenewDelegationTokenResp { void swap(TRenewDelegationTokenResp &a, TRenewDelegationTokenResp &b); + +class TGetJobIDsReq { + public: + + static const char* ascii_fingerprint; // = "414FA38522AE6B9CEC1438B56CA1DE5A"; + static const uint8_t binary_fingerprint[16]; // = {0x41,0x4F,0xA3,0x85,0x22,0xAE,0x6B,0x9C,0xEC,0x14,0x38,0xB5,0x6C,0xA1,0xDE,0x5A}; + + TGetJobIDsReq() { + } + + virtual ~TGetJobIDsReq() throw() {} + + TOperationHandle operationHandle; + + void __set_operationHandle(const TOperationHandle& val) { + operationHandle = val; + } + + bool operator == (const TGetJobIDsReq & rhs) const + { + if (!(operationHandle == rhs.operationHandle)) + return false; + return true; + } + bool operator != (const TGetJobIDsReq &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TGetJobIDsReq & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TGetJobIDsReq &a, TGetJobIDsReq &b); + + +class TGetJobIDsResp { + public: + + static const char* ascii_fingerprint; // = "19D0E199C6FCA381189B03E1959DCAB5"; + static const uint8_t binary_fingerprint[16]; // = {0x19,0xD0,0xE1,0x99,0xC6,0xFC,0xA3,0x81,0x18,0x9B,0x03,0xE1,0x95,0x9D,0xCA,0xB5}; + + TGetJobIDsResp() : executionEngine((TExecutionEngine::type)0) { + } + + virtual ~TGetJobIDsResp() throw() {} + + TStatus status; + TExecutionEngine::type executionEngine; + std::vector jobids; + + void __set_status(const TStatus& val) { + status = val; + } + + void __set_executionEngine(const TExecutionEngine::type val) { + executionEngine = val; + } + + void __set_jobids(const std::vector & val) { + jobids = val; + } + + bool operator == (const TGetJobIDsResp & rhs) const + { + if (!(status == rhs.status)) + return false; + if (!(executionEngine == rhs.executionEngine)) + return false; + if (!(jobids == rhs.jobids)) + return false; + return true; + } + bool operator != (const TGetJobIDsResp &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TGetJobIDsResp & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TGetJobIDsResp &a, TGetJobIDsResp &b); + }}}}} // namespace #endif diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TCLIService.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TCLIService.java index 54851b8d513179e3618ee5a974941bb6a72378b6..f3051a08160fc9d937342afe16f28066bd16877b 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TCLIService.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TCLIService.java @@ -73,6 +73,8 @@ public TRenewDelegationTokenResp RenewDelegationToken(TRenewDelegationTokenReq req) throws org.apache.thrift.TException; + public TGetJobIDsResp GetJobIDs(TGetJobIDsReq req) throws org.apache.thrift.TException; + } public interface AsyncIface { @@ -115,6 +117,8 @@ public void RenewDelegationToken(TRenewDelegationTokenReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void GetJobIDs(TGetJobIDsReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -574,6 +578,29 @@ public TRenewDelegationTokenResp recv_RenewDelegationToken() throws org.apache.t throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "RenewDelegationToken failed: unknown result"); } + public TGetJobIDsResp GetJobIDs(TGetJobIDsReq req) throws org.apache.thrift.TException + { + send_GetJobIDs(req); + return recv_GetJobIDs(); + } + + public void send_GetJobIDs(TGetJobIDsReq req) throws org.apache.thrift.TException + { + GetJobIDs_args args = new GetJobIDs_args(); + args.setReq(req); + sendBase("GetJobIDs", args); + } + + public TGetJobIDsResp recv_GetJobIDs() throws org.apache.thrift.TException + { + GetJobIDs_result result = new GetJobIDs_result(); + receiveBase(result, "GetJobIDs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "GetJobIDs failed: unknown result"); + } + } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { @@ -1200,6 +1227,38 @@ public TRenewDelegationTokenResp getResult() throws org.apache.thrift.TException } } + public void GetJobIDs(TGetJobIDsReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + GetJobIDs_call method_call = new GetJobIDs_call(req, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class GetJobIDs_call extends org.apache.thrift.async.TAsyncMethodCall { + private TGetJobIDsReq req; + public GetJobIDs_call(TGetJobIDsReq 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("GetJobIDs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + GetJobIDs_args args = new GetJobIDs_args(); + args.setReq(req); + args.write(prot); + prot.writeMessageEnd(); + } + + public TGetJobIDsResp 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_GetJobIDs(); + } + } + } public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { @@ -1232,6 +1291,7 @@ protected Processor(I iface, Map extends org.apache.thrift.ProcessFunction { + public GetJobIDs() { + super("GetJobIDs"); + } + + public GetJobIDs_args getEmptyArgsInstance() { + return new GetJobIDs_args(); + } + + protected boolean isOneway() { + return false; + } + + public GetJobIDs_result getResult(I iface, GetJobIDs_args args) throws org.apache.thrift.TException { + GetJobIDs_result result = new GetJobIDs_result(); + result.success = iface.GetJobIDs(args.req); + return result; + } + } + } public static class OpenSession_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { @@ -15411,4 +15491,730 @@ public void read(org.apache.thrift.protocol.TProtocol prot, RenewDelegationToken } + public static class GetJobIDs_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetJobIDs_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 GetJobIDs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new GetJobIDs_argsTupleSchemeFactory()); + } + + private TGetJobIDsReq 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, TGetJobIDsReq.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetJobIDs_args.class, metaDataMap); + } + + public GetJobIDs_args() { + } + + public GetJobIDs_args( + TGetJobIDsReq req) + { + this(); + this.req = req; + } + + /** + * Performs a deep copy on other. + */ + public GetJobIDs_args(GetJobIDs_args other) { + if (other.isSetReq()) { + this.req = new TGetJobIDsReq(other.req); + } + } + + public GetJobIDs_args deepCopy() { + return new GetJobIDs_args(this); + } + + @Override + public void clear() { + this.req = null; + } + + public TGetJobIDsReq getReq() { + return this.req; + } + + public void setReq(TGetJobIDsReq 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((TGetJobIDsReq)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 GetJobIDs_args) + return this.equals((GetJobIDs_args)that); + return false; + } + + public boolean equals(GetJobIDs_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() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_req = true && (isSetReq()); + builder.append(present_req); + if (present_req) + builder.append(req); + + return builder.toHashCode(); + } + + public int compareTo(GetJobIDs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + GetJobIDs_args typedOther = (GetJobIDs_args)other; + + lastComparison = Boolean.valueOf(isSetReq()).compareTo(typedOther.isSetReq()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetReq()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.req, typedOther.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("GetJobIDs_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 GetJobIDs_argsStandardSchemeFactory implements SchemeFactory { + public GetJobIDs_argsStandardScheme getScheme() { + return new GetJobIDs_argsStandardScheme(); + } + } + + private static class GetJobIDs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, GetJobIDs_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 TGetJobIDsReq(); + 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, GetJobIDs_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 GetJobIDs_argsTupleSchemeFactory implements SchemeFactory { + public GetJobIDs_argsTupleScheme getScheme() { + return new GetJobIDs_argsTupleScheme(); + } + } + + private static class GetJobIDs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, GetJobIDs_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, GetJobIDs_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.req = new TGetJobIDsReq(); + struct.req.read(iprot); + struct.setReqIsSet(true); + } + } + } + + } + + public static class GetJobIDs_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetJobIDs_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 GetJobIDs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new GetJobIDs_resultTupleSchemeFactory()); + } + + private TGetJobIDsResp 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, TGetJobIDsResp.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetJobIDs_result.class, metaDataMap); + } + + public GetJobIDs_result() { + } + + public GetJobIDs_result( + TGetJobIDsResp success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on other. + */ + public GetJobIDs_result(GetJobIDs_result other) { + if (other.isSetSuccess()) { + this.success = new TGetJobIDsResp(other.success); + } + } + + public GetJobIDs_result deepCopy() { + return new GetJobIDs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public TGetJobIDsResp getSuccess() { + return this.success; + } + + public void setSuccess(TGetJobIDsResp 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((TGetJobIDsResp)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 GetJobIDs_result) + return this.equals((GetJobIDs_result)that); + return false; + } + + public boolean equals(GetJobIDs_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() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_success = true && (isSetSuccess()); + builder.append(present_success); + if (present_success) + builder.append(success); + + return builder.toHashCode(); + } + + public int compareTo(GetJobIDs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + GetJobIDs_result typedOther = (GetJobIDs_result)other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + 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("GetJobIDs_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 GetJobIDs_resultStandardSchemeFactory implements SchemeFactory { + public GetJobIDs_resultStandardScheme getScheme() { + return new GetJobIDs_resultStandardScheme(); + } + } + + private static class GetJobIDs_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, GetJobIDs_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 TGetJobIDsResp(); + 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, GetJobIDs_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 GetJobIDs_resultTupleSchemeFactory implements SchemeFactory { + public GetJobIDs_resultTupleScheme getScheme() { + return new GetJobIDs_resultTupleScheme(); + } + } + + private static class GetJobIDs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, GetJobIDs_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, GetJobIDs_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new TGetJobIDsResp(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + } + } diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecutionEngine.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecutionEngine.java new file mode 100644 index 0000000000000000000000000000000000000000..e277be01eac07fac7e51c3c716e40f329dd86331 --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecutionEngine.java @@ -0,0 +1,42 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +public enum TExecutionEngine implements org.apache.thrift.TEnum { + MAPREDUCE(0); + + private final int value; + + private TExecutionEngine(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static TExecutionEngine findByValue(int value) { + switch (value) { + case 0: + return MAPREDUCE; + default: + return null; + } + } +} diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetJobIDsReq.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetJobIDsReq.java new file mode 100644 index 0000000000000000000000000000000000000000..1766dd7d0d6acc38ad55b2281b251cf05c0e6ca5 --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetJobIDsReq.java @@ -0,0 +1,390 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TGetJobIDsReq implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetJobIDsReq"); + + private static final org.apache.thrift.protocol.TField OPERATION_HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationHandle", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TGetJobIDsReqStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TGetJobIDsReqTupleSchemeFactory()); + } + + private TOperationHandle operationHandle; // 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 { + OPERATION_HANDLE((short)1, "operationHandle"); + + 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: // OPERATION_HANDLE + return OPERATION_HANDLE; + 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.OPERATION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("operationHandle", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TOperationHandle.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetJobIDsReq.class, metaDataMap); + } + + public TGetJobIDsReq() { + } + + public TGetJobIDsReq( + TOperationHandle operationHandle) + { + this(); + this.operationHandle = operationHandle; + } + + /** + * Performs a deep copy on other. + */ + public TGetJobIDsReq(TGetJobIDsReq other) { + if (other.isSetOperationHandle()) { + this.operationHandle = new TOperationHandle(other.operationHandle); + } + } + + public TGetJobIDsReq deepCopy() { + return new TGetJobIDsReq(this); + } + + @Override + public void clear() { + this.operationHandle = null; + } + + public TOperationHandle getOperationHandle() { + return this.operationHandle; + } + + public void setOperationHandle(TOperationHandle operationHandle) { + this.operationHandle = operationHandle; + } + + public void unsetOperationHandle() { + this.operationHandle = null; + } + + /** Returns true if field operationHandle is set (has been assigned a value) and false otherwise */ + public boolean isSetOperationHandle() { + return this.operationHandle != null; + } + + public void setOperationHandleIsSet(boolean value) { + if (!value) { + this.operationHandle = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case OPERATION_HANDLE: + if (value == null) { + unsetOperationHandle(); + } else { + setOperationHandle((TOperationHandle)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case OPERATION_HANDLE: + return getOperationHandle(); + + } + 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 OPERATION_HANDLE: + return isSetOperationHandle(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TGetJobIDsReq) + return this.equals((TGetJobIDsReq)that); + return false; + } + + public boolean equals(TGetJobIDsReq that) { + if (that == null) + return false; + + boolean this_present_operationHandle = true && this.isSetOperationHandle(); + boolean that_present_operationHandle = true && that.isSetOperationHandle(); + if (this_present_operationHandle || that_present_operationHandle) { + if (!(this_present_operationHandle && that_present_operationHandle)) + return false; + if (!this.operationHandle.equals(that.operationHandle)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_operationHandle = true && (isSetOperationHandle()); + builder.append(present_operationHandle); + if (present_operationHandle) + builder.append(operationHandle); + + return builder.toHashCode(); + } + + public int compareTo(TGetJobIDsReq other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TGetJobIDsReq typedOther = (TGetJobIDsReq)other; + + lastComparison = Boolean.valueOf(isSetOperationHandle()).compareTo(typedOther.isSetOperationHandle()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOperationHandle()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationHandle, typedOther.operationHandle); + 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("TGetJobIDsReq("); + boolean first = true; + + sb.append("operationHandle:"); + if (this.operationHandle == null) { + sb.append("null"); + } else { + sb.append(this.operationHandle); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetOperationHandle()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'operationHandle' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + if (operationHandle != null) { + operationHandle.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 TGetJobIDsReqStandardSchemeFactory implements SchemeFactory { + public TGetJobIDsReqStandardScheme getScheme() { + return new TGetJobIDsReqStandardScheme(); + } + } + + private static class TGetJobIDsReqStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TGetJobIDsReq 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: // OPERATION_HANDLE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.operationHandle = new TOperationHandle(); + struct.operationHandle.read(iprot); + struct.setOperationHandleIsSet(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, TGetJobIDsReq struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.operationHandle != null) { + oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC); + struct.operationHandle.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TGetJobIDsReqTupleSchemeFactory implements SchemeFactory { + public TGetJobIDsReqTupleScheme getScheme() { + return new TGetJobIDsReqTupleScheme(); + } + } + + private static class TGetJobIDsReqTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TGetJobIDsReq struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.operationHandle.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TGetJobIDsReq struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.operationHandle = new TOperationHandle(); + struct.operationHandle.read(iprot); + struct.setOperationHandleIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetJobIDsResp.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetJobIDsResp.java new file mode 100644 index 0000000000000000000000000000000000000000..e51f40cfeb91394c161dd4346746574ebf4990aa --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetJobIDsResp.java @@ -0,0 +1,656 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TGetJobIDsResp implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetJobIDsResp"); + + private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField EXECUTION_ENGINE_FIELD_DESC = new org.apache.thrift.protocol.TField("executionEngine", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField JOBIDS_FIELD_DESC = new org.apache.thrift.protocol.TField("jobids", org.apache.thrift.protocol.TType.LIST, (short)3); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TGetJobIDsRespStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TGetJobIDsRespTupleSchemeFactory()); + } + + private TStatus status; // required + private TExecutionEngine executionEngine; // required + private List jobids; // 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 { + STATUS((short)1, "status"), + /** + * + * @see TExecutionEngine + */ + EXECUTION_ENGINE((short)2, "executionEngine"), + JOBIDS((short)3, "jobids"); + + 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: // STATUS + return STATUS; + case 2: // EXECUTION_ENGINE + return EXECUTION_ENGINE; + case 3: // JOBIDS + return JOBIDS; + 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStatus.class))); + tmpMap.put(_Fields.EXECUTION_ENGINE, new org.apache.thrift.meta_data.FieldMetaData("executionEngine", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TExecutionEngine.class))); + tmpMap.put(_Fields.JOBIDS, new org.apache.thrift.meta_data.FieldMetaData("jobids", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetJobIDsResp.class, metaDataMap); + } + + public TGetJobIDsResp() { + } + + public TGetJobIDsResp( + TStatus status, + TExecutionEngine executionEngine, + List jobids) + { + this(); + this.status = status; + this.executionEngine = executionEngine; + this.jobids = jobids; + } + + /** + * Performs a deep copy on other. + */ + public TGetJobIDsResp(TGetJobIDsResp other) { + if (other.isSetStatus()) { + this.status = new TStatus(other.status); + } + if (other.isSetExecutionEngine()) { + this.executionEngine = other.executionEngine; + } + if (other.isSetJobids()) { + List __this__jobids = new ArrayList(); + for (String other_element : other.jobids) { + __this__jobids.add(other_element); + } + this.jobids = __this__jobids; + } + } + + public TGetJobIDsResp deepCopy() { + return new TGetJobIDsResp(this); + } + + @Override + public void clear() { + this.status = null; + this.executionEngine = null; + this.jobids = null; + } + + public TStatus getStatus() { + return this.status; + } + + public void setStatus(TStatus status) { + this.status = status; + } + + public void unsetStatus() { + this.status = null; + } + + /** Returns true if field status is set (has been assigned a value) and false otherwise */ + public boolean isSetStatus() { + return this.status != null; + } + + public void setStatusIsSet(boolean value) { + if (!value) { + this.status = null; + } + } + + /** + * + * @see TExecutionEngine + */ + public TExecutionEngine getExecutionEngine() { + return this.executionEngine; + } + + /** + * + * @see TExecutionEngine + */ + public void setExecutionEngine(TExecutionEngine executionEngine) { + this.executionEngine = executionEngine; + } + + public void unsetExecutionEngine() { + this.executionEngine = null; + } + + /** Returns true if field executionEngine is set (has been assigned a value) and false otherwise */ + public boolean isSetExecutionEngine() { + return this.executionEngine != null; + } + + public void setExecutionEngineIsSet(boolean value) { + if (!value) { + this.executionEngine = null; + } + } + + public int getJobidsSize() { + return (this.jobids == null) ? 0 : this.jobids.size(); + } + + public java.util.Iterator getJobidsIterator() { + return (this.jobids == null) ? null : this.jobids.iterator(); + } + + public void addToJobids(String elem) { + if (this.jobids == null) { + this.jobids = new ArrayList(); + } + this.jobids.add(elem); + } + + public List getJobids() { + return this.jobids; + } + + public void setJobids(List jobids) { + this.jobids = jobids; + } + + public void unsetJobids() { + this.jobids = null; + } + + /** Returns true if field jobids is set (has been assigned a value) and false otherwise */ + public boolean isSetJobids() { + return this.jobids != null; + } + + public void setJobidsIsSet(boolean value) { + if (!value) { + this.jobids = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case STATUS: + if (value == null) { + unsetStatus(); + } else { + setStatus((TStatus)value); + } + break; + + case EXECUTION_ENGINE: + if (value == null) { + unsetExecutionEngine(); + } else { + setExecutionEngine((TExecutionEngine)value); + } + break; + + case JOBIDS: + if (value == null) { + unsetJobids(); + } else { + setJobids((List)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case STATUS: + return getStatus(); + + case EXECUTION_ENGINE: + return getExecutionEngine(); + + case JOBIDS: + return getJobids(); + + } + 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 STATUS: + return isSetStatus(); + case EXECUTION_ENGINE: + return isSetExecutionEngine(); + case JOBIDS: + return isSetJobids(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TGetJobIDsResp) + return this.equals((TGetJobIDsResp)that); + return false; + } + + public boolean equals(TGetJobIDsResp that) { + if (that == null) + return false; + + boolean this_present_status = true && this.isSetStatus(); + boolean that_present_status = true && that.isSetStatus(); + if (this_present_status || that_present_status) { + if (!(this_present_status && that_present_status)) + return false; + if (!this.status.equals(that.status)) + return false; + } + + boolean this_present_executionEngine = true && this.isSetExecutionEngine(); + boolean that_present_executionEngine = true && that.isSetExecutionEngine(); + if (this_present_executionEngine || that_present_executionEngine) { + if (!(this_present_executionEngine && that_present_executionEngine)) + return false; + if (!this.executionEngine.equals(that.executionEngine)) + return false; + } + + boolean this_present_jobids = true && this.isSetJobids(); + boolean that_present_jobids = true && that.isSetJobids(); + if (this_present_jobids || that_present_jobids) { + if (!(this_present_jobids && that_present_jobids)) + return false; + if (!this.jobids.equals(that.jobids)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_status = true && (isSetStatus()); + builder.append(present_status); + if (present_status) + builder.append(status); + + boolean present_executionEngine = true && (isSetExecutionEngine()); + builder.append(present_executionEngine); + if (present_executionEngine) + builder.append(executionEngine.getValue()); + + boolean present_jobids = true && (isSetJobids()); + builder.append(present_jobids); + if (present_jobids) + builder.append(jobids); + + return builder.toHashCode(); + } + + public int compareTo(TGetJobIDsResp other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TGetJobIDsResp typedOther = (TGetJobIDsResp)other; + + lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetStatus()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExecutionEngine()).compareTo(typedOther.isSetExecutionEngine()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExecutionEngine()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.executionEngine, typedOther.executionEngine); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetJobids()).compareTo(typedOther.isSetJobids()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetJobids()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jobids, typedOther.jobids); + 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("TGetJobIDsResp("); + boolean first = true; + + sb.append("status:"); + if (this.status == null) { + sb.append("null"); + } else { + sb.append(this.status); + } + first = false; + if (!first) sb.append(", "); + sb.append("executionEngine:"); + if (this.executionEngine == null) { + sb.append("null"); + } else { + sb.append(this.executionEngine); + } + first = false; + if (!first) sb.append(", "); + sb.append("jobids:"); + if (this.jobids == null) { + sb.append("null"); + } else { + sb.append(this.jobids); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetStatus()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString()); + } + + if (!isSetExecutionEngine()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'executionEngine' is unset! Struct:" + toString()); + } + + if (!isSetJobids()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'jobids' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + if (status != null) { + status.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 TGetJobIDsRespStandardSchemeFactory implements SchemeFactory { + public TGetJobIDsRespStandardScheme getScheme() { + return new TGetJobIDsRespStandardScheme(); + } + } + + private static class TGetJobIDsRespStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TGetJobIDsResp 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: // STATUS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.status = new TStatus(); + struct.status.read(iprot); + struct.setStatusIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // EXECUTION_ENGINE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.executionEngine = TExecutionEngine.findByValue(iprot.readI32()); + struct.setExecutionEngineIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // JOBIDS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list180 = iprot.readListBegin(); + struct.jobids = new ArrayList(_list180.size); + for (int _i181 = 0; _i181 < _list180.size; ++_i181) + { + String _elem182; // required + _elem182 = iprot.readString(); + struct.jobids.add(_elem182); + } + iprot.readListEnd(); + } + struct.setJobidsIsSet(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, TGetJobIDsResp struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.status != null) { + oprot.writeFieldBegin(STATUS_FIELD_DESC); + struct.status.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.executionEngine != null) { + oprot.writeFieldBegin(EXECUTION_ENGINE_FIELD_DESC); + oprot.writeI32(struct.executionEngine.getValue()); + oprot.writeFieldEnd(); + } + if (struct.jobids != null) { + oprot.writeFieldBegin(JOBIDS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.jobids.size())); + for (String _iter183 : struct.jobids) + { + oprot.writeString(_iter183); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TGetJobIDsRespTupleSchemeFactory implements SchemeFactory { + public TGetJobIDsRespTupleScheme getScheme() { + return new TGetJobIDsRespTupleScheme(); + } + } + + private static class TGetJobIDsRespTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TGetJobIDsResp struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.status.write(oprot); + oprot.writeI32(struct.executionEngine.getValue()); + { + oprot.writeI32(struct.jobids.size()); + for (String _iter184 : struct.jobids) + { + oprot.writeString(_iter184); + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TGetJobIDsResp struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.status = new TStatus(); + struct.status.read(iprot); + struct.setStatusIsSet(true); + struct.executionEngine = TExecutionEngine.findByValue(iprot.readI32()); + struct.setExecutionEngineIsSet(true); + { + org.apache.thrift.protocol.TList _list185 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.jobids = new ArrayList(_list185.size); + for (int _i186 = 0; _i186 < _list185.size; ++_i186) + { + String _elem187; // required + _elem187 = iprot.readString(); + struct.jobids.add(_elem187); + } + } + struct.setJobidsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-php/TCLIService.php service/src/gen/thrift/gen-php/TCLIService.php index d2462967c4ee40c46bdeb6c8e24e22e63f3567e3..fcb8bd5e1fc840465f3c5196aa83c69d5bcaf242 100644 --- service/src/gen/thrift/gen-php/TCLIService.php +++ service/src/gen/thrift/gen-php/TCLIService.php @@ -35,6 +35,7 @@ interface TCLIServiceIf { public function GetDelegationToken(\TGetDelegationTokenReq $req); public function CancelDelegationToken(\TCancelDelegationTokenReq $req); public function RenewDelegationToken(\TRenewDelegationTokenReq $req); + public function GetJobIDs(\TGetJobIDsReq $req); } class TCLIServiceClient implements \TCLIServiceIf { @@ -1017,6 +1018,57 @@ class TCLIServiceClient implements \TCLIServiceIf { throw new \Exception("RenewDelegationToken failed: unknown result"); } + public function GetJobIDs(\TGetJobIDsReq $req) + { + $this->send_GetJobIDs($req); + return $this->recv_GetJobIDs(); + } + + public function send_GetJobIDs(\TGetJobIDsReq $req) + { + $args = new \TCLIService_GetJobIDs_args(); + $args->req = $req; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'GetJobIDs', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('GetJobIDs', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_GetJobIDs() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\TCLIService_GetJobIDs_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_GetJobIDs_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("GetJobIDs failed: unknown result"); + } + } // HELPER FUNCTIONS AND STRUCTURES @@ -3947,4 +3999,158 @@ class TCLIService_RenewDelegationToken_result { } +class TCLIService_GetJobIDs_args { + static $_TSPEC; + + public $req = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'req', + 'type' => TType::STRUCT, + 'class' => '\TGetJobIDsReq', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['req'])) { + $this->req = $vals['req']; + } + } + } + + public function getName() { + return 'TCLIService_GetJobIDs_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 \TGetJobIDsReq(); + $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_GetJobIDs_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_GetJobIDs_result { + static $_TSPEC; + + public $success = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRUCT, + 'class' => '\TGetJobIDsResp', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + } + } + + public function getName() { + return 'TCLIService_GetJobIDs_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 \TGetJobIDsResp(); + $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_GetJobIDs_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; + } + +} + diff --git service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote old mode 100644 new mode 100755 index f6ff43f021524adb1a179595bfdd9260e98bff28..1ea140365a9ada591c1b1f96937506984fadd8c2 --- service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote +++ service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote @@ -42,6 +42,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' TGetDelegationTokenResp GetDelegationToken(TGetDelegationTokenReq req)' print ' TCancelDelegationTokenResp CancelDelegationToken(TCancelDelegationTokenReq req)' print ' TRenewDelegationTokenResp RenewDelegationToken(TRenewDelegationTokenReq req)' + print ' TGetJobIDsResp GetJobIDs(TGetJobIDsReq req)' print '' sys.exit(0) @@ -207,6 +208,12 @@ elif cmd == 'RenewDelegationToken': sys.exit(1) pp.pprint(client.RenewDelegationToken(eval(args[0]),)) +elif cmd == 'GetJobIDs': + if len(args) != 1: + print 'GetJobIDs requires 1 args' + sys.exit(1) + pp.pprint(client.GetJobIDs(eval(args[0]),)) + else: print 'Unrecognized method %s' % cmd sys.exit(1) diff --git service/src/gen/thrift/gen-py/TCLIService/TCLIService.py service/src/gen/thrift/gen-py/TCLIService/TCLIService.py index ebc65746ccd7e58c0878f426b429274d4b59ed0b..a56f0f02519c7891aa008ad2c4aa052282236ee7 100644 --- service/src/gen/thrift/gen-py/TCLIService/TCLIService.py +++ service/src/gen/thrift/gen-py/TCLIService/TCLIService.py @@ -151,6 +151,13 @@ def RenewDelegationToken(self, req): """ pass + def GetJobIDs(self, req): + """ + Parameters: + - req + """ + pass + class Client(Iface): def __init__(self, iprot, oprot=None): @@ -729,6 +736,36 @@ def recv_RenewDelegationToken(self, ): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "RenewDelegationToken failed: unknown result"); + def GetJobIDs(self, req): + """ + Parameters: + - req + """ + self.send_GetJobIDs(req) + return self.recv_GetJobIDs() + + def send_GetJobIDs(self, req): + self._oprot.writeMessageBegin('GetJobIDs', TMessageType.CALL, self._seqid) + args = GetJobIDs_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetJobIDs(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = GetJobIDs_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetJobIDs failed: unknown result"); + class Processor(Iface, TProcessor): def __init__(self, handler): @@ -753,6 +790,7 @@ def __init__(self, handler): self._processMap["GetDelegationToken"] = Processor.process_GetDelegationToken self._processMap["CancelDelegationToken"] = Processor.process_CancelDelegationToken self._processMap["RenewDelegationToken"] = Processor.process_RenewDelegationToken + self._processMap["GetJobIDs"] = Processor.process_GetJobIDs def process(self, iprot, oprot): (name, type, seqid) = iprot.readMessageBegin() @@ -978,6 +1016,17 @@ def process_RenewDelegationToken(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_GetJobIDs(self, seqid, iprot, oprot): + args = GetJobIDs_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetJobIDs_result() + result.success = self._handler.GetJobIDs(args.req) + oprot.writeMessageBegin("GetJobIDs", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + # HELPER FUNCTIONS AND STRUCTURES @@ -3279,3 +3328,124 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) + +class GetJobIDs_args: + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetJobIDsReq, TGetJobIDsReq.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 = TGetJobIDsReq() + 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('GetJobIDs_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 __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 GetJobIDs_result: + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetJobIDsResp, TGetJobIDsResp.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 = TGetJobIDsResp() + 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('GetJobIDs_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 __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) diff --git service/src/gen/thrift/gen-py/TCLIService/ttypes.py service/src/gen/thrift/gen-py/TCLIService/ttypes.py index 6cd64d0386f1e7c73eee7d9868c387c4942a5f9f..4f76f8ec64c7b00f297f5dbd403f6fa8a0802599 100644 --- service/src/gen/thrift/gen-py/TCLIService/ttypes.py +++ service/src/gen/thrift/gen-py/TCLIService/ttypes.py @@ -378,6 +378,17 @@ class TFetchOrientation: "FETCH_LAST": 5, } +class TExecutionEngine: + MAPREDUCE = 0 + + _VALUES_TO_NAMES = { + 0: "MAPREDUCE", + } + + _NAMES_TO_VALUES = { + "MAPREDUCE": 0, + } + class TTypeQualifierValue: """ @@ -6382,3 +6393,165 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) + +class TGetJobIDsReq: + """ + Attributes: + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, operationHandle=None,): + 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.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('TGetJobIDsReq') + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationHandle is None: + raise TProtocol.TProtocolException(message='Required field operationHandle is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TGetJobIDsResp: + """ + Attributes: + - status + - executionEngine + - jobids + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.I32, 'executionEngine', None, None, ), # 2 + (3, TType.LIST, 'jobids', (TType.STRING,None), None, ), # 3 + ) + + def __init__(self, status=None, executionEngine=None, jobids=None,): + self.status = status + self.executionEngine = executionEngine + self.jobids = jobids + + 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.I32: + self.executionEngine = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.LIST: + self.jobids = [] + (_etype162, _size159) = iprot.readListBegin() + for _i163 in xrange(_size159): + _elem164 = iprot.readString(); + self.jobids.append(_elem164) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetJobIDsResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.executionEngine is not None: + oprot.writeFieldBegin('executionEngine', TType.I32, 2) + oprot.writeI32(self.executionEngine) + oprot.writeFieldEnd() + if self.jobids is not None: + oprot.writeFieldBegin('jobids', TType.LIST, 3) + oprot.writeListBegin(TType.STRING, len(self.jobids)) + for iter165 in self.jobids: + oprot.writeString(iter165) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocol.TProtocolException(message='Required field status is unset!') + if self.executionEngine is None: + raise TProtocol.TProtocolException(message='Required field executionEngine is unset!') + if self.jobids is None: + raise TProtocol.TProtocolException(message='Required field jobids is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) diff --git service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote old mode 100644 new mode 100755 diff --git service/src/gen/thrift/gen-rb/t_c_l_i_service.rb service/src/gen/thrift/gen-rb/t_c_l_i_service.rb index fd1ca9aa13f3db170caf310ebb1ee1bac9f70b63..21cce42de942b45e751aca3237033a73979ba597 100644 --- service/src/gen/thrift/gen-rb/t_c_l_i_service.rb +++ service/src/gen/thrift/gen-rb/t_c_l_i_service.rb @@ -296,6 +296,21 @@ module TCLIService raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'RenewDelegationToken failed: unknown result') end + def GetJobIDs(req) + send_GetJobIDs(req) + return recv_GetJobIDs() + end + + def send_GetJobIDs(req) + send_message('GetJobIDs', GetJobIDs_args, :req => req) + end + + def recv_GetJobIDs() + result = receive_message(GetJobIDs_result) + return result.success unless result.success.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'GetJobIDs failed: unknown result') + end + end class Processor @@ -434,6 +449,13 @@ module TCLIService write_result(result, oprot, 'RenewDelegationToken', seqid) end + def process_GetJobIDs(seqid, iprot, oprot) + args = read_args(iprot, GetJobIDs_args) + result = GetJobIDs_result.new() + result.success = @handler.GetJobIDs(args.req) + write_result(result, oprot, 'GetJobIDs', seqid) + end + end # HELPER FUNCTIONS AND STRUCTURES @@ -1046,5 +1068,37 @@ module TCLIService ::Thrift::Struct.generate_accessors self end + class GetJobIDs_args + include ::Thrift::Struct, ::Thrift::Struct_Union + REQ = 1 + + FIELDS = { + REQ => {:type => ::Thrift::Types::STRUCT, :name => 'req', :class => ::TGetJobIDsReq} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class GetJobIDs_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::TGetJobIDsResp} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + end diff --git service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb index c731544888f7480b0b1af70440ce1697e8597c12..e9801540c6cb854d739de01028a78076e394ec15 100644 --- service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb +++ service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb @@ -143,6 +143,12 @@ module TFetchOrientation VALID_VALUES = Set.new([FETCH_NEXT, FETCH_PRIOR, FETCH_RELATIVE, FETCH_ABSOLUTE, FETCH_FIRST, FETCH_LAST]).freeze end +module TExecutionEngine + MAPREDUCE = 0 + VALUE_MAP = {0 => "MAPREDUCE"} + VALID_VALUES = Set.new([MAPREDUCE]).freeze +end + class TTypeQualifierValue < ::Thrift::Union include ::Thrift::Struct_Union class << self @@ -1758,3 +1764,46 @@ class TRenewDelegationTokenResp ::Thrift::Struct.generate_accessors self end +class TGetJobIDsReq + include ::Thrift::Struct, ::Thrift::Struct_Union + OPERATIONHANDLE = 1 + + FIELDS = { + OPERATIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'operationHandle', :class => ::TOperationHandle} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field operationHandle is unset!') unless @operationHandle + end + + ::Thrift::Struct.generate_accessors self +end + +class TGetJobIDsResp + include ::Thrift::Struct, ::Thrift::Struct_Union + STATUS = 1 + EXECUTIONENGINE = 2 + JOBIDS = 3 + + FIELDS = { + STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::TStatus}, + EXECUTIONENGINE => {:type => ::Thrift::Types::I32, :name => 'executionEngine', :enum_class => ::TExecutionEngine}, + JOBIDS => {:type => ::Thrift::Types::LIST, :name => 'jobids', :element => {:type => ::Thrift::Types::STRING}} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field executionEngine is unset!') unless @executionEngine + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field jobids is unset!') unless @jobids + unless @executionEngine.nil? || ::TExecutionEngine::VALID_VALUES.include?(@executionEngine) + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field executionEngine!') + end + end + + ::Thrift::Struct.generate_accessors self +end + diff --git service/src/java/org/apache/hive/service/cli/CLIService.java service/src/java/org/apache/hive/service/cli/CLIService.java index f5751f1305d7dd4c1f74af5a3a4f94f018b7a38f..446c6c44de1f3a9b426db6950d3c5811192aa7be 100644 --- service/src/java/org/apache/hive/service/cli/CLIService.java +++ service/src/java/org/apache/hive/service/cli/CLIService.java @@ -36,6 +36,7 @@ import org.apache.hadoop.hive.metastore.IMetaStoreClient; import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hive.service.CompositeService; @@ -430,6 +431,14 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio return rowSet; } + @Override + public JobIDSet getJobIDs(OperationHandle opHandle) throws HiveSQLException { + JobIDSet jobIDs = sessionManager.getOperationManager().getOperation(opHandle). + getParentSession().getJobIDs(opHandle); + LOG.debug(opHandle + ": getJobIDs()"); + return jobIDs; + } + // obtain delegation token for the give user from metastore public synchronized String getDelegationTokenFromMetaStore(String owner) throws HiveSQLException, UnsupportedOperationException, LoginException, IOException { @@ -478,4 +487,4 @@ public void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory au public SessionManager getSessionManager() { return sessionManager; } -} +} \ No newline at end of file diff --git service/src/java/org/apache/hive/service/cli/CLIServiceClient.java service/src/java/org/apache/hive/service/cli/CLIServiceClient.java index 3155c238ff688bfea16b0aaeea950599bb659b5b..fca0c0fd90f8f5566b5a63df53200eeee2582020 100644 --- service/src/java/org/apache/hive/service/cli/CLIServiceClient.java +++ service/src/java/org/apache/hive/service/cli/CLIServiceClient.java @@ -53,4 +53,4 @@ public abstract void cancelDelegationToken(SessionHandle sessionHandle, HiveAuth public abstract void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException; -} +} \ No newline at end of file diff --git service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java index 9cad5be198c063115a8e90c67b1c2fd910ca8bc6..a967931e11afbb0761e58437eac040a17cab96d6 100644 --- service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java +++ service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Map; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hive.service.auth.HiveAuthFactory; @@ -187,6 +188,10 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio return cliService.fetchResults(opHandle, orientation, maxRows, fetchType); } + @Override + public JobIDSet getJobIDs(OperationHandle opHandle) throws HiveSQLException { + return cliService.getJobIDs(opHandle); + } @Override public String getDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, diff --git service/src/java/org/apache/hive/service/cli/ICLIService.java service/src/java/org/apache/hive/service/cli/ICLIService.java index c9cc1f4da56f1cd10f6348ea2b9e17e203b87664..30957b32d71906652bb59b81937c10c7f770f181 100644 --- service/src/java/org/apache/hive/service/cli/ICLIService.java +++ service/src/java/org/apache/hive/service/cli/ICLIService.java @@ -21,8 +21,7 @@ import java.util.Map; - - +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hive.service.auth.HiveAuthFactory; public interface ICLIService { @@ -92,7 +91,9 @@ RowSet fetchResults(OperationHandle opHandle) RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException; - String getDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, + JobIDSet getJobIDs(OperationHandle opHandle) throws HiveSQLException; + + String getDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException; void cancelDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, diff --git service/src/java/org/apache/hive/service/cli/operation/Operation.java service/src/java/org/apache/hive/service/cli/operation/Operation.java index acb95cb015395f4a1a9280c3b0c719228e584df7..72dfefcd5fc2856a0e42215ede53e27ebbc26b0b 100644 --- service/src/java/org/apache/hive/service/cli/operation/Operation.java +++ service/src/java/org/apache/hive/service/cli/operation/Operation.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.util.EnumSet; +import java.util.List; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -29,6 +30,7 @@ import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse; import org.apache.hive.service.cli.FetchOrientation; import org.apache.hive.service.cli.HiveSQLException; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hive.service.cli.OperationHandle; import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationStatus; @@ -286,6 +288,10 @@ public RowSet getNextRowSet() throws HiveSQLException { return getNextRowSet(FetchOrientation.FETCH_NEXT, DEFAULT_FETCH_MAX_ROWS); } + public JobIDSet getJobIDs() { + throw new UnsupportedOperationException("getJobIDs not supported for this operation"); + } + /** * Verify if the given fetch orientation is part of the default orientation types. * @param orientation diff --git service/src/java/org/apache/hive/service/cli/operation/OperationManager.java service/src/java/org/apache/hive/service/cli/operation/OperationManager.java index a57b6e5d322ac312636c19633cee44f711b653df..0520e19405cb245b694dec3025d4c9d04ee9eabc 100644 --- service/src/java/org/apache/hive/service/cli/operation/OperationManager.java +++ service/src/java/org/apache/hive/service/cli/operation/OperationManager.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.Schema; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hive.service.AbstractService; import org.apache.hive.service.cli.*; import org.apache.hive.service.cli.session.HiveSession; @@ -253,6 +254,10 @@ public RowSet getOperationLogRowSet(OperationHandle opHandle, return rowSet; } + public JobIDSet getJobIDs(OperationHandle opHandle) throws HiveSQLException { + return getOperation(opHandle).getJobIDs(); + } + private Schema getLogSchema() { Schema schema = new Schema(); FieldSchema fieldSchema = new FieldSchema(); diff --git service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java index 8cabf7ee2945296774d31925a2bce46a7320d668..7ff6c541363f810980edfb9420d137b9918ec864 100644 --- service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java @@ -55,6 +55,7 @@ import org.apache.hadoop.security.UserGroupInformation; import org.apache.hive.service.cli.FetchOrientation; import org.apache.hive.service.cli.HiveSQLException; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.RowSet; import org.apache.hive.service.cli.RowSetFactory; @@ -349,6 +350,17 @@ public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws H } } + @Override + public JobIDSet getJobIDs() { + if (driver != null) { + return driver.getJobIDs(); + } else { + LOG.error("Could not retrieve job IDs. Either operation has finished " + + "running or has not started running yet."); + return null; + } + } + private RowSet decode(List rows, RowSet rowSet) throws Exception { if (driver.isFetchingTable()) { return prepareFromRow(rows, rowSet); diff --git service/src/java/org/apache/hive/service/cli/session/HiveSession.java service/src/java/org/apache/hive/service/cli/session/HiveSession.java index 6359a5b879928e8726017520f9a733d6b11decd4..7a7e1f2a000468049f1f00d53ad5645abeee1885 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSession.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSession.java @@ -22,6 +22,7 @@ import java.util.Map; import org.apache.hadoop.hive.metastore.IMetaStoreClient; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hive.service.auth.HiveAuthFactory; import org.apache.hive.service.cli.*; @@ -141,6 +142,8 @@ TableSchema getResultSetMetadata(OperationHandle opHandle) RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException; + JobIDSet getJobIDs(OperationHandle opHandle) throws HiveSQLException; + String getDelegationToken(HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException; diff --git service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java index fa28a6b6a4acb61d8b442ed13b0421e1e0f13368..d5d561fba6df8a7a6b9590e2155062df51d3958e 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java @@ -43,6 +43,7 @@ import org.apache.hadoop.hive.ql.history.HiveHistory; import org.apache.hadoop.hive.ql.processors.SetProcessor; import org.apache.hadoop.hive.ql.session.SessionState; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hive.common.util.HiveVersionInfo; import org.apache.hive.service.auth.HiveAuthFactory; @@ -680,6 +681,16 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio } } + @Override + public JobIDSet getJobIDs(OperationHandle opHandle) throws HiveSQLException { + acquire(true); + try { + return operationManager.getJobIDs(opHandle); + } finally { + release(true); + } + } + protected HiveSession getSession() { return this; } diff --git service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java index a0a6e183bbd05cd61ba97f187d66b286c145969c..ace4e3cfc6218db2bb53de848ec13c6165cf784e 100644 --- service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java +++ service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -34,6 +35,8 @@ import org.apache.hive.service.auth.HiveAuthFactory; import org.apache.hive.service.auth.TSetIpAddressProcessor; import org.apache.hive.service.cli.*; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; +import org.apache.hadoop.hive.ql.thrift.JobIDSet.ExecutionEngine; import org.apache.hive.service.cli.session.SessionManager; import org.apache.hive.service.server.HiveServer2; import org.apache.thrift.TException; @@ -595,6 +598,32 @@ public TFetchResultsResp FetchResults(TFetchResultsReq req) throws TException { } @Override + public TGetJobIDsResp GetJobIDs(TGetJobIDsReq req) throws TException { + TGetJobIDsResp resp = new TGetJobIDsResp(); + try { + JobIDSet jobIDs = cliService.getJobIDs( + new OperationHandle(req.getOperationHandle())); + if (jobIDs == null) { + TStatus tStatus = new TStatus(TStatusCode.ERROR_STATUS); + tStatus.setErrorMessage("No Job IDs found. Either this operation " + + "has finished running, not started running yet or does not launch MR jobs."); + resp.setStatus(tStatus); + return resp; + } + + if (jobIDs.getExecutionEngine() == ExecutionEngine.MAPREDUCE) { + resp.setExecutionEngine(TExecutionEngine.MAPREDUCE); + } + resp.setJobids(jobIDs.getIds()); + resp.setStatus(OK_STATUS); + } catch (Exception e) { + LOG.warn("Error fetching job ids: " + e, e); + resp.setStatus(HiveSQLException.toTStatus(e)); + } + return resp; + } + + @Override public abstract void run(); /** diff --git service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java index 1af45398b895cd7616c5627d318422e14b81e734..37ab39199e3dcb7eb066fdaefd1cbb278dce542b 100644 --- service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java +++ service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java @@ -21,6 +21,8 @@ import java.util.List; import java.util.Map; +import org.apache.hadoop.hive.ql.thrift.JobIDSet; +import org.apache.hadoop.hive.ql.thrift.JobIDSet.ExecutionEngine; import org.apache.hive.service.auth.HiveAuthFactory; import org.apache.hive.service.cli.*; import org.apache.thrift.TException; @@ -385,6 +387,26 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio } } + @Override + public JobIDSet getJobIDs(OperationHandle opHandle) throws HiveSQLException { + try { + TGetJobIDsReq req = new TGetJobIDsReq(); + req.setOperationHandle(opHandle.toTOperationHandle()); + TGetJobIDsResp resp = cliService.GetJobIDs(req); + checkStatus(resp.getStatus()); + JobIDSet jobIDSet = new JobIDSet(); + if (resp.getExecutionEngine() == TExecutionEngine.MAPREDUCE) { + jobIDSet.setExecutionEngine(ExecutionEngine.MAPREDUCE); + } + jobIDSet.setIds(resp.getJobids()); + return jobIDSet; + } catch (HiveSQLException e) { + throw e; + } catch (Exception e) { + throw new HiveSQLException(e); + } + } + /* (non-Javadoc) * @see org.apache.hive.service.cli.ICLIService#fetchResults(org.apache.hive.service.cli.OperationHandle) */ diff --git service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java index 630cfc9124abf7a8871b613b967141d0447eb18e..77598806b04addd7ace2b12c862367224b3ff9bb 100644 --- service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java +++ service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java @@ -300,4 +300,4 @@ public void testExecuteStatementAsync() throws Exception { client.closeSession(sessHandle); } -} +} \ No newline at end of file