コード例 #1
0
ファイル: Query.java プロジェクト: hyunsik/incubator-tajo
  public float getProgress() {
    QueryState state = getStateMachine().getCurrentState();
    if (state == QueryState.QUERY_SUCCEEDED) {
      return 1.0f;
    } else {
      int idx = 0;
      List<SubQuery> tempSubQueries = new ArrayList<SubQuery>();
      synchronized (subqueries) {
        tempSubQueries.addAll(subqueries.values());
      }
      float[] subProgresses = new float[tempSubQueries.size()];
      boolean finished = true;
      for (SubQuery subquery : tempSubQueries) {
        if (subquery.getState() != SubQueryState.NEW) {
          subProgresses[idx] = subquery.getProgress();
          if (finished && subquery.getState() != SubQueryState.SUCCEEDED) {
            finished = false;
          }
        } else {
          subProgresses[idx] = 0.0f;
        }
        idx++;
      }

      if (finished) {
        return 1.0f;
      }

      float totalProgress = 0;
      float proportion =
          1.0f / (float) (getExecutionBlockCursor().size() - 1); // minus one is due to

      for (int i = 0; i < subProgresses.length; i++) {
        totalProgress += subProgresses[i] * proportion;
      }

      return totalProgress;
    }
  }
コード例 #2
0
ファイル: Query.java プロジェクト: hyunsik/incubator-tajo
 public QueryHookExecutor(QueryMaster.QueryMasterContext context) {
   this.context = context;
   hookList.add(new MaterializedResultHook());
   hookList.add(new CreateTableHook());
   hookList.add(new InsertTableHook());
 }
コード例 #3
0
ファイル: Query.java プロジェクト: hyunsik/incubator-tajo
 protected void addDiagnostic(String diag) {
   diagnostics.add(diag);
 }