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


Java Query类代码示例

本文整理汇总了Java中org.apache.tajo.master.querymaster.Query的典型用法代码示例。如果您正苦于以下问题:Java Query类的具体用法?Java Query怎么用?Java Query使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Query类属于org.apache.tajo.master.querymaster包,在下文中一共展示了Query类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stop

import org.apache.tajo.master.querymaster.Query; //导入依赖的package包/类
public void stop() {
  if(stopped.get()) {
    return;
  }
  LOG.info("un-registering ApplicationMaster(QueryMaster):" + appAttemptId);
  stopped.set(true);

  try {
    FinalApplicationStatus status = FinalApplicationStatus.UNDEFINED;
    Query query = context.getQuery();
    if (query != null) {
      TajoProtos.QueryState state = query.getState();
      if (state == TajoProtos.QueryState.QUERY_SUCCEEDED) {
        status = FinalApplicationStatus.SUCCEEDED;
      } else if (state == TajoProtos.QueryState.QUERY_FAILED || state == TajoProtos.QueryState.QUERY_ERROR) {
        status = FinalApplicationStatus.FAILED;
      } else if (state == TajoProtos.QueryState.QUERY_ERROR) {
        status = FinalApplicationStatus.FAILED;
      }
    }
    unregisterApplicationMaster(status, "tajo query finished", null);
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);
  }

  allocatorThread.interrupt();
  LOG.info("un-registered ApplicationMAster(QueryMaster) stopped:" + appAttemptId);

  super.stop();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:31,代码来源:YarnRMContainerAllocator.java

示例2: getQueryResult

import org.apache.tajo.master.querymaster.Query; //导入依赖的package包/类
@Override
public ClientProtos.GetQueryResultResponse getQueryResult(
        RpcController controller,
        ClientProtos.GetQueryResultRequest request) throws ServiceException {
  QueryId queryId = new QueryId(request.getQueryId());
  Query query = workerContext.getQueryMaster().getQueryMasterTask(queryId, true).getQuery();

  ClientProtos.GetQueryResultResponse.Builder builder = ClientProtos.GetQueryResultResponse.newBuilder();
  try {
    builder.setTajoUserName(UserGroupInformation.getCurrentUser().getUserName());
  } catch (IOException e) {
    LOG.warn("Can't get current user name");
  }

  if(query == null) {
    builder.setErrorMessage("No Query for " + queryId);
  } else {
    switch (query.getState()) {
      case QUERY_SUCCEEDED:
        builder.setTableDesc(query.getResultDesc().getProto());
        break;
      case QUERY_FAILED:
      case QUERY_ERROR:
        builder.setErrorMessage("Query " + queryId + " is failed");
      default:
        builder.setErrorMessage("Query " + queryId + " is still running");
    }
  }
  return builder.build();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:31,代码来源:TajoWorkerClientService.java

示例3: getQueryStatus

import org.apache.tajo.master.querymaster.Query; //导入依赖的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

示例4: getQueryStatus

import org.apache.tajo.master.querymaster.Query; //导入依赖的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.Query类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。