當前位置: 首頁>>代碼示例>>Java>>正文


Java AggregationFunctionCallEval類代碼示例

本文整理匯總了Java中org.apache.tajo.engine.eval.AggregationFunctionCallEval的典型用法代碼示例。如果您正苦於以下問題:Java AggregationFunctionCallEval類的具體用法?Java AggregationFunctionCallEval怎麽用?Java AggregationFunctionCallEval使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AggregationFunctionCallEval類屬於org.apache.tajo.engine.eval包,在下文中一共展示了AggregationFunctionCallEval類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clone

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
@Override
public Object clone() throws CloneNotSupportedException {
  GroupbyNode grp = (GroupbyNode) super.clone();
  if (groupingColumns != null) {
    grp.groupingColumns = new Column[groupingColumns.length];
    for (int i = 0; i < groupingColumns.length; i++) {
      grp.groupingColumns[i] = (Column) groupingColumns[i].clone();
    }
  }

  if (aggrFunctions != null) {
    grp.aggrFunctions = new AggregationFunctionCallEval[aggrFunctions.length];
    for (int i = 0; i < aggrFunctions.length; i++) {
      grp.aggrFunctions[i] = (AggregationFunctionCallEval) aggrFunctions[i].clone();
    }
  }

  if (targets != null) {
    grp.targets = new Target[targets.length];
    for (int i = 0; i < targets.length; i++) {
      grp.targets[i] = (Target) targets[i].clone();
    }
  }

  return grp;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:27,代碼來源:GroupbyNode.java

示例2: AggregationExec

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
public AggregationExec(final TaskAttemptContext context, GroupbyNode plan,
                       PhysicalExec child) throws IOException {
  super(context, plan.getInSchema(), plan.getOutSchema(), child);
  this.plan = plan;

  evalSchema = plan.getOutSchema();

  final Column [] keyColumns = plan.getGroupingColumns();
  groupingKeyNum = keyColumns.length;
  groupingKeyIds = new int[groupingKeyNum];
  Column col;
  for (int idx = 0; idx < plan.getGroupingColumns().length; idx++) {
    col = keyColumns[idx];
    groupingKeyIds[idx] = inSchema.getColumnId(col.getQualifiedName());
  }

  if (plan.hasAggFunctions()) {
    aggFunctions = plan.getAggFunctions();
    aggFunctionsNum = aggFunctions.length;
  } else {
    aggFunctions = new AggregationFunctionCallEval[0];
    aggFunctionsNum = 0;
  }
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:25,代碼來源:AggregationExec.java

示例3: testCountFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
@Test
public final void testCountFunction() throws IOException, PlanningException {
  FileFragment[] frags = StorageManager.splitNG(conf, "score", score.getMeta(), score.getPath(),
      Integer.MAX_VALUE);
  Path workDir = CommonTestingUtil.getTestDir("target/test-data/testCountFunction");
  TaskAttemptContext ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan),
      new FileFragment[] { frags[0] }, workDir);
  ctx.setEnforcer(new Enforcer());
  Expr context = analyzer.parse(QUERIES[9]);
  LogicalPlan plan = planner.createPlan(context);
  LogicalNode rootNode = optimizer.optimize(plan);

  // Set all aggregation functions to the first phase mode
  GroupbyNode groupbyNode = PlannerUtil.findTopNode(rootNode, NodeType.GROUP_BY);
  for (AggregationFunctionCallEval function : groupbyNode.getAggFunctions()) {
    function.setFirstPhase();
  }

  PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf,sm);
  PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode);
  exec.init();
  Tuple tuple = exec.next();
  assertEquals(30, tuple.get(0).asInt8());
  assertNull(exec.next());
  exec.close();
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:27,代碼來源:TestPhysicalPlanner.java

示例4: clone

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
@Override
public Object clone() throws CloneNotSupportedException {
  GroupbyNode grp = (GroupbyNode) super.clone();
  if (groupingColumns != null) {
    grp.groupingColumns = new Column[groupingColumns.length];
    for (int i = 0; i < groupingColumns.length; i++) {
      grp.groupingColumns[i] = groupingColumns[i];
    }
  }

  if (aggrFunctions != null) {
    grp.aggrFunctions = new AggregationFunctionCallEval[aggrFunctions.length];
    for (int i = 0; i < aggrFunctions.length; i++) {
      grp.aggrFunctions[i] = (AggregationFunctionCallEval) aggrFunctions[i].clone();
    }
  }

  if (targets != null) {
    grp.targets = new Target[targets.length];
    for (int i = 0; i < targets.length; i++) {
      grp.targets[i] = (Target) targets[i].clone();
    }
  }

  return grp;
}
 
開發者ID:gruter,項目名稱:tajo-cdh,代碼行數:27,代碼來源:GroupbyNode.java

示例5: testCountFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
@Test
public final void testCountFunction() throws IOException, PlanningException {
  FileFragment[] frags = StorageManager.splitNG(conf, "default.score", score.getMeta(), score.getPath(),
      Integer.MAX_VALUE);
  Path workDir = CommonTestingUtil.getTestDir("target/test-data/testCountFunction");
  TaskAttemptContext ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan),
      new FileFragment[] { frags[0] }, workDir);
  ctx.setEnforcer(new Enforcer());
  Expr context = analyzer.parse(QUERIES[9]);
  LogicalPlan plan = planner.createPlan(session, context);
  LogicalNode rootNode = optimizer.optimize(plan);

  // Set all aggregation functions to the first phase mode
  GroupbyNode groupbyNode = PlannerUtil.findTopNode(rootNode, NodeType.GROUP_BY);
  for (AggregationFunctionCallEval function : groupbyNode.getAggFunctions()) {
    function.setFirstPhase();
  }

  PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf,sm);
  PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode);
  exec.init();
  Tuple tuple = exec.next();
  assertEquals(30, tuple.get(0).asInt8());
  assertNull(exec.next());
  exec.close();
}
 
開發者ID:gruter,項目名稱:tajo-cdh,代碼行數:27,代碼來源:TestPhysicalPlanner.java

示例6: createFirstPhaseGroupBy

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
public static GroupbyNode createFirstPhaseGroupBy(LogicalPlan plan, GroupbyNode groupBy) {
  Preconditions.checkNotNull(groupBy);

  GroupbyNode firstPhaseGroupBy = PlannerUtil.clone(plan, groupBy);
  GroupbyNode secondPhaseGroupBy = groupBy;

  // Set first phase expressions
  if (secondPhaseGroupBy.hasAggFunctions()) {
    int evalNum = secondPhaseGroupBy.getAggFunctions().length;
    AggregationFunctionCallEval [] secondPhaseEvals = secondPhaseGroupBy.getAggFunctions();
    AggregationFunctionCallEval [] firstPhaseEvals = new AggregationFunctionCallEval[evalNum];

    String [] firstPhaseEvalNames = new String[evalNum];
    for (int i = 0; i < evalNum; i++) {
      try {
        firstPhaseEvals[i] = (AggregationFunctionCallEval) secondPhaseEvals[i].clone();
      } catch (CloneNotSupportedException e) {
        throw new RuntimeException(e);
      }

      firstPhaseEvals[i].setFirstPhase();
      firstPhaseEvalNames[i] = plan.generateUniqueColumnName(firstPhaseEvals[i]);
      FieldEval param = new FieldEval(firstPhaseEvalNames[i], firstPhaseEvals[i].getValueType());
      secondPhaseEvals[i].setArgs(new EvalNode[] {param});
    }

    secondPhaseGroupBy.setAggFunctions(secondPhaseEvals);
    firstPhaseGroupBy.setAggFunctions(firstPhaseEvals);
    Target [] firstPhaseTargets = ProjectionPushDownRule.buildGroupByTarget(firstPhaseGroupBy, null,
        firstPhaseEvalNames);
    firstPhaseGroupBy.setTargets(firstPhaseTargets);
    secondPhaseGroupBy.setInSchema(PlannerUtil.targetToSchema(firstPhaseTargets));
  }
  return firstPhaseGroupBy;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:36,代碼來源:GlobalPlanner.java

示例7: testAggregationFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
@Test
public final void testAggregationFunction() throws IOException, PlanningException {
  FileFragment[] frags = StorageManager.splitNG(conf, "score", score.getMeta(), score.getPath(),
      Integer.MAX_VALUE);
  Path workDir = CommonTestingUtil.getTestDir("target/test-data/testAggregationFunction");
  TaskAttemptContext ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan),
      new FileFragment[] { frags[0] }, workDir);
  ctx.setEnforcer(new Enforcer());
  Expr context = analyzer.parse(QUERIES[8]);
  LogicalPlan plan = planner.createPlan(context);
  LogicalNode rootNode = optimizer.optimize(plan);

  // Set all aggregation functions to the first phase mode
  GroupbyNode groupbyNode = PlannerUtil.findTopNode(rootNode, NodeType.GROUP_BY);
  for (AggregationFunctionCallEval function : groupbyNode.getAggFunctions()) {
    function.setFirstPhase();
  }

  PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf,sm);
  PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode);

  exec.init();
  Tuple tuple = exec.next();
  assertEquals(30, tuple.get(0).asInt8());
  assertEquals(3, tuple.get(1).asInt4());
  assertEquals(1, tuple.get(2).asInt4());
  assertNull(exec.next());
  exec.close();
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:30,代碼來源:TestPhysicalPlanner.java

示例8: testAggregationFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
@Test
public final void testAggregationFunction() throws IOException, PlanningException {
  FileFragment[] frags = StorageManager.splitNG(conf, "default.score", score.getMeta(), score.getPath(),
      Integer.MAX_VALUE);
  Path workDir = CommonTestingUtil.getTestDir("target/test-data/testAggregationFunction");
  TaskAttemptContext ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan),
      new FileFragment[] { frags[0] }, workDir);
  ctx.setEnforcer(new Enforcer());
  Expr context = analyzer.parse(QUERIES[8]);
  LogicalPlan plan = planner.createPlan(session, context);
  LogicalNode rootNode = optimizer.optimize(plan);

  // Set all aggregation functions to the first phase mode
  GroupbyNode groupbyNode = PlannerUtil.findTopNode(rootNode, NodeType.GROUP_BY);
  for (AggregationFunctionCallEval function : groupbyNode.getAggFunctions()) {
    function.setFirstPhase();
  }

  PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf,sm);
  PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode);

  exec.init();
  Tuple tuple = exec.next();
  assertEquals(30, tuple.get(0).asInt8());
  assertEquals(3, tuple.get(1).asInt4());
  assertEquals(1, tuple.get(2).asInt4());
  assertNull(exec.next());
  exec.close();
}
 
開發者ID:gruter,項目名稱:tajo-cdh,代碼行數:30,代碼來源:TestPhysicalPlanner.java

示例9: createSumFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
private AggregationFunctionCallEval createSumFunction(EvalNode [] args) throws InternalException {
  FunctionDesc functionDesc = getCatalog().getFunction("sum", CatalogProtos.FunctionType.AGGREGATION,
      args[0].getValueType());
  return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:6,代碼來源:GlobalPlanner.java

示例10: createCountFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
private AggregationFunctionCallEval createCountFunction(EvalNode [] args) throws InternalException {
  FunctionDesc functionDesc = getCatalog().getFunction("count", CatalogProtos.FunctionType.AGGREGATION,
      args[0].getValueType());
  return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:6,代碼來源:GlobalPlanner.java

示例11: createCountRowFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
private AggregationFunctionCallEval createCountRowFunction(EvalNode[] args) throws InternalException {
  FunctionDesc functionDesc = getCatalog().getFunction("count", CatalogProtos.FunctionType.AGGREGATION,
      new TajoDataTypes.DataType[]{});
  return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:6,代碼來源:GlobalPlanner.java

示例12: createMaxFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
private AggregationFunctionCallEval createMaxFunction(EvalNode [] args) throws InternalException {
  FunctionDesc functionDesc = getCatalog().getFunction("max", CatalogProtos.FunctionType.AGGREGATION,
      args[0].getValueType());
  return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:6,代碼來源:GlobalPlanner.java

示例13: createMinFunction

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
private AggregationFunctionCallEval createMinFunction(EvalNode [] args) throws InternalException {
  FunctionDesc functionDesc = getCatalog().getFunction("min", CatalogProtos.FunctionType.AGGREGATION,
      args[0].getValueType());
  return new AggregationFunctionCallEval(functionDesc, (AggFunction) functionDesc.newInstance(), args);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:6,代碼來源:GlobalPlanner.java

示例14: RewrittenFunctions

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
public RewrittenFunctions(int firstStageEvalNum) {
  firstStageEvals = new AggregationFunctionCallEval[firstStageEvalNum];
  firstStageTargets = new Target[firstStageEvalNum];
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:5,代碼來源:GlobalPlanner.java

示例15: getAggFunctions

import org.apache.tajo.engine.eval.AggregationFunctionCallEval; //導入依賴的package包/類
public AggregationFunctionCallEval [] getAggFunctions() {
  return this.aggrFunctions;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:4,代碼來源:GroupbyNode.java


注:本文中的org.apache.tajo.engine.eval.AggregationFunctionCallEval類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。