本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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();
}