当前位置: 首页>>代码示例>>Java>>正文


Java QueryMasterTask.getQuery方法代码示例

本文整理汇总了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();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:47,代码来源:TajoWorkerClientService.java

示例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();
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:53,代码来源:TajoWorkerClientService.java


注:本文中的org.apache.tajo.master.querymaster.QueryMasterTask.getQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。