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


Java AggregationFunctionCallEval.setFirstPhase方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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


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