当前位置: 首页>>代码示例>>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;未经允许,请勿转载。