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


Java QueryInProgress.getQueryInfo方法代码示例

本文整理汇总了Java中org.apache.tajo.master.querymaster.QueryInProgress.getQueryInfo方法的典型用法代码示例。如果您正苦于以下问题:Java QueryInProgress.getQueryInfo方法的具体用法?Java QueryInProgress.getQueryInfo怎么用?Java QueryInProgress.getQueryInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tajo.master.querymaster.QueryInProgress的用法示例。


在下文中一共展示了QueryInProgress.getQueryInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRunningQueryList

import org.apache.tajo.master.querymaster.QueryInProgress; //导入方法依赖的package包/类
@Override
public GetQueryListResponse getRunningQueryList(RpcController controller, GetQueryListRequest request)

    throws ServiceException {

  try {
    context.getSessionManager().touch(request.getSessionId().getId());
    GetQueryListResponse.Builder builder= GetQueryListResponse.newBuilder();

    Collection<QueryInProgress> queries
      = context.getQueryJobManager().getRunningQueries();

    BriefQueryInfo.Builder infoBuilder = BriefQueryInfo.newBuilder();

    for (QueryInProgress queryInProgress : queries) {
      QueryInfo queryInfo = queryInProgress.getQueryInfo();

      infoBuilder.setQueryId(queryInfo.getQueryId().getProto());
      infoBuilder.setState(queryInfo.getQueryState());
      infoBuilder.setQuery(queryInfo.getSql());
      infoBuilder.setStartTime(queryInfo.getStartTime());
      long endTime = (queryInfo.getFinishTime() == 0) ?
                     System.currentTimeMillis() : queryInfo.getFinishTime();
      infoBuilder.setFinishTime(endTime);
      infoBuilder.setProgress(queryInfo.getProgress());
      infoBuilder.setQueryMasterPort(queryInfo.getQueryMasterPort());
      infoBuilder.setQueryMasterHost(queryInfo.getQueryMasterHost());

      builder.addQueryList(infoBuilder.build());
    }

    GetQueryListResponse result = builder.build();
    return result;
  } catch (Throwable t) {
    throw new ServiceException(t);
  }
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:38,代码来源:TajoMasterClientService.java

示例2: getQueryResult

import org.apache.tajo.master.querymaster.QueryInProgress; //导入方法依赖的package包/类
@Override
public GetQueryResultResponse getQueryResult(RpcController controller,
                                             GetQueryResultRequest request)
    throws ServiceException {
  QueryId queryId = new QueryId(request.getQueryId());
  QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);
  QueryInfo queryInfo = queryInProgress.getQueryInfo();
  GetQueryResultResponse.Builder builder
      = GetQueryResultResponse.newBuilder();

  try {
    //TODO After implementation Tajo's user security feature, Should be modified.
    builder.setTajoUserName(UserGroupInformation.getCurrentUser().getUserName());
  } catch (IOException e) {
    LOG.warn("Can't get current user name");
  }
  switch (queryInfo.getQueryState()) {
    case QUERY_SUCCEEDED:
      // TODO check this logic needed
      //builder.setTableDesc((TableDescProto) queryJobManager.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,代码来源:TajoMasterClientService.java

示例3: getRunningQueryList

import org.apache.tajo.master.querymaster.QueryInProgress; //导入方法依赖的package包/类
@Override
public GetQueryListResponse getRunningQueryList(RpcController controller,
                                         GetQueryListRequest request)
    throws ServiceException {
  GetQueryListResponse.Builder builder
    = GetQueryListResponse.newBuilder(); 
   
  Collection<QueryInProgress> queries 
    = context.getQueryJobManager().getRunningQueries();

  BriefQueryInfo.Builder infoBuilder = BriefQueryInfo.newBuilder();
 
  for (QueryInProgress queryInProgress : queries) {
    QueryInfo queryInfo = queryInProgress.getQueryInfo();

    infoBuilder.setQueryId(queryInfo.getQueryId().getProto());
    infoBuilder.setState(queryInfo.getQueryState());
    infoBuilder.setQuery(queryInfo.getSql());
    infoBuilder.setStartTime(queryInfo.getStartTime());
    long endTime = (queryInfo.getFinishTime() == 0) ? 
                   System.currentTimeMillis() : queryInfo.getFinishTime();
    infoBuilder.setFinishTime(endTime);
    infoBuilder.setProgress(queryInfo.getProgress());
    infoBuilder.setQueryMasterPort(queryInfo.getQueryMasterPort());
    infoBuilder.setQueryMasterHost(queryInfo.getQueryMasterHost());

    builder.addQueryList(infoBuilder.build());
  }

  GetQueryListResponse result = builder.build();
  return result;
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:33,代码来源:TajoMasterClientService.java

示例4: getFinishedQueryList

import org.apache.tajo.master.querymaster.QueryInProgress; //导入方法依赖的package包/类
@Override
public GetQueryListResponse getFinishedQueryList(RpcController controller,
                                         GetQueryListRequest request)
    throws ServiceException {
  GetQueryListResponse.Builder builder
      = GetQueryListResponse.newBuilder();

  Collection<QueryInProgress> queries
      = context.getQueryJobManager().getFinishedQueries();

  BriefQueryInfo.Builder infoBuilder = BriefQueryInfo.newBuilder();

  for (QueryInProgress queryInProgress : queries) {
    QueryInfo queryInfo = queryInProgress.getQueryInfo();

    infoBuilder.setQueryId(queryInfo.getQueryId().getProto());
    infoBuilder.setState(queryInfo.getQueryState());
    infoBuilder.setQuery(queryInfo.getSql());
    infoBuilder.setStartTime(queryInfo.getStartTime());
    long endTime = (queryInfo.getFinishTime() == 0) ?
        System.currentTimeMillis() : queryInfo.getFinishTime();
    infoBuilder.setFinishTime(endTime);
    infoBuilder.setProgress(queryInfo.getProgress());
    infoBuilder.setQueryMasterPort(queryInfo.getQueryMasterPort());
    infoBuilder.setQueryMasterHost(queryInfo.getQueryMasterHost());

    builder.addQueryList(infoBuilder.build());
  }

  GetQueryListResponse result = builder.build();
  return result;
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:33,代码来源:TajoMasterClientService.java

示例5: getQueryStatus

import org.apache.tajo.master.querymaster.QueryInProgress; //导入方法依赖的package包/类
@Override
public GetQueryStatusResponse getQueryStatus(RpcController controller,
                                             GetQueryStatusRequest request)
    throws ServiceException {

  GetQueryStatusResponse.Builder builder
      = GetQueryStatusResponse.newBuilder();
  QueryId queryId = new QueryId(request.getQueryId());
  builder.setQueryId(request.getQueryId());

  if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
    builder.setResultCode(ResultCode.OK);
    builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
  } else {
    QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);
    if (queryInProgress != null) {
      QueryInfo queryInfo = queryInProgress.getQueryInfo();
      builder.setResultCode(ResultCode.OK);
      builder.setState(queryInfo.getQueryState());
      builder.setProgress(queryInfo.getProgress());
      builder.setSubmitTime(queryInfo.getStartTime());
      if(queryInfo.getQueryMasterHost() != null) {
        builder.setQueryMasterHost(queryInfo.getQueryMasterHost());
        builder.setQueryMasterPort(queryInfo.getQueryMasterClientPort());
      }
      //builder.setInitTime(queryJobManager.getInitializationTime());
      //builder.setHasResult(!queryJobManager.isCreateTableStmt());
      if (queryInfo.getQueryState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
        builder.setFinishTime(queryInfo.getFinishTime());
      } else {
        builder.setFinishTime(System.currentTimeMillis());
      }
    } else {
      builder.setResultCode(ResultCode.ERROR);
      builder.setErrorMessage("No such query: " + queryId.toString());
    }
  }

  return builder.build();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:41,代码来源:TajoMasterClientService.java

示例6: getFinishedQueryList

import org.apache.tajo.master.querymaster.QueryInProgress; //导入方法依赖的package包/类
@Override
public GetQueryListResponse getFinishedQueryList(RpcController controller, GetQueryListRequest request)
    throws ServiceException {

  try {
    context.getSessionManager().touch(request.getSessionId().getId());
    GetQueryListResponse.Builder builder = GetQueryListResponse.newBuilder();

    Collection<QueryInProgress> queries
        = context.getQueryJobManager().getFinishedQueries();

    BriefQueryInfo.Builder infoBuilder = BriefQueryInfo.newBuilder();

    for (QueryInProgress queryInProgress : queries) {
      QueryInfo queryInfo = queryInProgress.getQueryInfo();

      infoBuilder.setQueryId(queryInfo.getQueryId().getProto());
      infoBuilder.setState(queryInfo.getQueryState());
      infoBuilder.setQuery(queryInfo.getSql());
      infoBuilder.setStartTime(queryInfo.getStartTime());
      long endTime = (queryInfo.getFinishTime() == 0) ?
          System.currentTimeMillis() : queryInfo.getFinishTime();
      infoBuilder.setFinishTime(endTime);
      infoBuilder.setProgress(queryInfo.getProgress());
      infoBuilder.setQueryMasterPort(queryInfo.getQueryMasterPort());
      infoBuilder.setQueryMasterHost(queryInfo.getQueryMasterHost());

      builder.addQueryList(infoBuilder.build());
    }

    GetQueryListResponse result = builder.build();
    return result;
  } catch (Throwable t) {
    throw new ServiceException(t);
  }
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:37,代码来源:TajoMasterClientService.java

示例7: getQueryResult

import org.apache.tajo.master.querymaster.QueryInProgress; //导入方法依赖的package包/类
@Override
public GetQueryResultResponse getQueryResult(RpcController controller,
                                             GetQueryResultRequest request) throws ServiceException {
  try {
    context.getSessionManager().touch(request.getSessionId().getId());
    QueryId queryId = new QueryId(request.getQueryId());
    QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);

    // if we cannot get a QueryInProgress instance from QueryJobManager,
    // the instance can be in the finished query list.
    if (queryInProgress == null) {
      queryInProgress = context.getQueryJobManager().getFinishedQuery(queryId);
    }

    GetQueryResultResponse.Builder builder = GetQueryResultResponse.newBuilder();

    // If we cannot the QueryInProgress instance from the finished list,
    // the query result was expired due to timeout.
    // In this case, we will result in error.
    if (queryInProgress == null) {
      builder.setErrorMessage("No such query: " + queryId.toString());
      return builder.build();
    }

    QueryInfo queryInfo = queryInProgress.getQueryInfo();

    try {
      //TODO After implementation Tajo's user security feature, Should be modified.
      builder.setTajoUserName(UserGroupInformation.getCurrentUser().getUserName());
    } catch (IOException e) {
      LOG.warn("Can't get current user name");
    }
    switch (queryInfo.getQueryState()) {
      case QUERY_SUCCEEDED:
        // TODO check this logic needed
        //builder.setTableDesc((TableDescProto) queryJobManager.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();
  } catch (Throwable t) {
    throw new ServiceException(t);
  }
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:50,代码来源:TajoMasterClientService.java

示例8: getQueryStatus

import org.apache.tajo.master.querymaster.QueryInProgress; //导入方法依赖的package包/类
@Override
public GetQueryStatusResponse getQueryStatus(RpcController controller,
                                             GetQueryStatusRequest request)
    throws ServiceException {

  try {
    context.getSessionManager().touch(request.getSessionId().getId());

    GetQueryStatusResponse.Builder builder = GetQueryStatusResponse.newBuilder();
    QueryId queryId = new QueryId(request.getQueryId());
    builder.setQueryId(request.getQueryId());

    if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
      builder.setResultCode(ResultCode.OK);
      builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
    } else {
      QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);

      // It will try to find a query status from a finished query list.
      if (queryInProgress == null) {
        queryInProgress = context.getQueryJobManager().getFinishedQuery(queryId);
      }
      if (queryInProgress != null) {
        QueryInfo queryInfo = queryInProgress.getQueryInfo();
        builder.setResultCode(ResultCode.OK);
        builder.setState(queryInfo.getQueryState());
        builder.setProgress(queryInfo.getProgress());
        builder.setSubmitTime(queryInfo.getStartTime());
        if(queryInfo.getQueryMasterHost() != null) {
          builder.setQueryMasterHost(queryInfo.getQueryMasterHost());
          builder.setQueryMasterPort(queryInfo.getQueryMasterClientPort());
        }
        if (queryInfo.getQueryState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
          builder.setFinishTime(queryInfo.getFinishTime());
        } else {
          builder.setFinishTime(System.currentTimeMillis());
        }
      } else {
        builder.setResultCode(ResultCode.ERROR);
        builder.setErrorMessage("No such query: " + queryId.toString());
      }
    }
    return builder.build();

  } catch (Throwable t) {
    throw new  ServiceException(t);
  }
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:49,代码来源:TajoMasterClientService.java


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