本文整理汇总了Java中org.apache.tajo.master.querymaster.QueryMasterTask.getQuery方法的典型用法代码示例。如果您正苦于以下问题:Java QueryMasterTask.getQuery方法的具体用法?Java QueryMasterTask.getQuery怎么用?Java QueryMasterTask.getQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tajo.master.querymaster.QueryMasterTask
的用法示例。
在下文中一共展示了QueryMasterTask.getQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQueryStatus
import org.apache.tajo.master.querymaster.QueryMasterTask; //导入方法依赖的package包/类
@Override
public ClientProtos.GetQueryStatusResponse getQueryStatus(
RpcController controller,
ClientProtos.GetQueryStatusRequest request) throws ServiceException {
ClientProtos.GetQueryStatusResponse.Builder builder
= ClientProtos.GetQueryStatusResponse.newBuilder();
QueryId queryId = new QueryId(request.getQueryId());
builder.setQueryId(request.getQueryId());
if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
builder.setResultCode(ClientProtos.ResultCode.OK);
builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
} else {
QueryMasterTask queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId);
builder.setResultCode(ClientProtos.ResultCode.OK);
builder.setQueryMasterHost(bindAddr.getHostName());
builder.setQueryMasterPort(bindAddr.getPort());
if (queryMasterTask == null) {
queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId, true);
}
if (queryMasterTask == null) {
builder.setState(TajoProtos.QueryState.QUERY_NOT_ASSIGNED);
return builder.build();
}
queryMasterTask.touchSessionTime();
Query query = queryMasterTask.getQuery();
builder.setState(query.getState());
builder.setProgress(query.getProgress());
builder.setSubmitTime(query.getAppSubmitTime());
builder.setHasResult(
!(queryMasterTask.getQueryTaskContext().getQueryContext().isCreateTable() ||
queryMasterTask.getQueryTaskContext().getQueryContext().isInsert())
);
if (query.getState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
builder.setFinishTime(query.getFinishTime());
} else {
builder.setFinishTime(System.currentTimeMillis());
}
}
return builder.build();
}
示例2: getQueryStatus
import org.apache.tajo.master.querymaster.QueryMasterTask; //导入方法依赖的package包/类
@Override
public ClientProtos.GetQueryStatusResponse getQueryStatus(
RpcController controller,
ClientProtos.GetQueryStatusRequest request) throws ServiceException {
ClientProtos.GetQueryStatusResponse.Builder builder
= ClientProtos.GetQueryStatusResponse.newBuilder();
QueryId queryId = new QueryId(request.getQueryId());
builder.setQueryId(request.getQueryId());
if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
builder.setResultCode(ClientProtos.ResultCode.OK);
builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
} else {
QueryMasterTask queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId);
builder.setResultCode(ClientProtos.ResultCode.OK);
builder.setQueryMasterHost(bindAddr.getHostName());
builder.setQueryMasterPort(bindAddr.getPort());
if (queryMasterTask == null) {
queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId, true);
}
if (queryMasterTask == null) {
builder.setState(TajoProtos.QueryState.QUERY_NOT_ASSIGNED);
return builder.build();
}
builder.setHasResult(
!(queryMasterTask.getQueryTaskContext().getQueryContext().isCreateTable() ||
queryMasterTask.getQueryTaskContext().getQueryContext().isInsert())
);
queryMasterTask.touchSessionTime();
Query query = queryMasterTask.getQuery();
if (query != null) {
builder.setState(query.getState());
builder.setProgress(query.getProgress());
builder.setSubmitTime(query.getAppSubmitTime());
if (query.getState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
builder.setFinishTime(query.getFinishTime());
} else {
builder.setFinishTime(System.currentTimeMillis());
}
} else {
builder.setState(queryMasterTask.getState());
builder.setErrorMessage(queryMasterTask.getErrorMessage());
}
}
return builder.build();
}