public AggregationExec(final TaskAttemptContext context, GroupbyNode plan, PhysicalExec child) throws IOException { super(context, plan.getInSchema(), plan.getOutSchema(), child); final Column [] keyColumns = plan.getGroupingColumns(); groupingKeyNum = keyColumns.length; if (plan.hasAggFunctions()) { aggFunctions = plan.getAggFunctions(); aggFunctionsNum = aggFunctions.size(); } else { aggFunctions = new ArrayList<>(); aggFunctionsNum = 0; } }
sb.append(", out schema:").append(getOutSchema().toString()); sb.append(", in schema:").append(getInSchema().toString());
sb.append(", out schema:").append(getOutSchema().toString()); sb.append(", in schema:").append(getInSchema().toString());
planStr.addDetail("out schema:").appendDetail(getOutSchema().toString()); planStr.addDetail("in schema:").appendDetail(getInSchema().toString());
public AggregationExec(final TaskAttemptContext context, GroupbyNode plan, PhysicalExec child) throws IOException { super(context, plan.getInSchema(), plan.getOutSchema(), child); final Column [] keyColumns = plan.getGroupingColumns(); groupingKeyNum = keyColumns.length; if (plan.hasAggFunctions()) { aggFunctions = plan.getAggFunctions(); aggFunctionsNum = aggFunctions.length; } else { aggFunctions = new AggregationFunctionCallEval[0]; aggFunctionsNum = 0; } }
planStr.addDetail("out schema:").appendDetail(getOutSchema().toString()); planStr.addDetail("in schema:").appendDetail(getInSchema().toString());
allGroupbyOutColNum += eachGroupby.getOutSchema().size();
public HashAggregateExec(TaskAttemptContext ctx, GroupbyNode plan, PhysicalExec subOp) throws IOException { super(ctx, plan, subOp); hashKeyProjector = new KeyProjector(inSchema, plan.getGroupingColumns()); hashTable = new TupleMap<>(ctx.getQueryContext().getInt(SessionVars.AGG_HASH_TABLE_SIZE)); this.tuple = new VTuple(plan.getOutSchema().size()); }
allGroupbyOutColNum += eachGroupby.getOutSchema().size();
public HashAggregateExec(TaskAttemptContext ctx, GroupbyNode plan, PhysicalExec subOp) throws IOException { super(ctx, plan, subOp); hashKeyProjector = new KeyProjector(inSchema, plan.getGroupingColumns()); hashTable = new TupleMap<>(ctx.getQueryContext().getInt(SessionVars.AGG_HASH_TABLE_SIZE)); this.tuple = new VTuple(plan.getOutSchema().size()); }
public DistinctGroupbySortAggregationExec(final TaskAttemptContext context, DistinctGroupbyNode plan, SortAggregateExec[] aggregateExecs) throws IOException { super(context, plan.getInSchema(), plan.getOutSchema()); this.aggregateExecs = aggregateExecs; this.groupbyNodeNum = plan.getSubPlans().size(); currentTuples = new Tuple[groupbyNodeNum]; outColumnNum = outSchema.size(); outTuple = new VTuple(outColumnNum); int allGroupbyOutColNum = 0; for (GroupbyNode eachGroupby: plan.getSubPlans()) { allGroupbyOutColNum += eachGroupby.getOutSchema().size(); } resultColumnIdIndexes = new int[allGroupbyOutColNum]; for (int i = 0; i < allGroupbyOutColNum; i++) { resultColumnIdIndexes[i] = -1; } int[] resultColumnIds = plan.getResultColumnIds(); for(int i = 0; i < resultColumnIds.length; i++) { resultColumnIdIndexes[resultColumnIds[i]] = i; } }
public DistinctGroupbySortAggregationExec(final TaskAttemptContext context, DistinctGroupbyNode plan, SortAggregateExec[] aggregateExecs) throws IOException { super(context, plan.getInSchema(), plan.getOutSchema()); this.aggregateExecs = aggregateExecs; this.groupbyNodeNum = plan.getSubPlans().size(); currentTuples = new Tuple[groupbyNodeNum]; outColumnNum = outSchema.size(); outTuple = new VTuple(outColumnNum); int allGroupbyOutColNum = 0; for (GroupbyNode eachGroupby: plan.getSubPlans()) { allGroupbyOutColNum += eachGroupby.getOutSchema().size(); } resultColumnIdIndexes = new int[allGroupbyOutColNum]; for (int i = 0; i < allGroupbyOutColNum; i++) { resultColumnIdIndexes[i] = -1; } int[] resultColumnIds = plan.getResultColumnIds(); for(int i = 0; i < resultColumnIds.length; i++) { resultColumnIdIndexes[resultColumnIds[i]] = i; } }
private void insertDistinctOperator(LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode projectionNode, LogicalNode child) throws TajoException { if (projectionNode.getChild().getType() != NodeType.GROUP_BY) { Schema outSchema = projectionNode.getOutSchema(); GroupbyNode dupRemoval = plan.createNode(GroupbyNode.class); dupRemoval.setChild(child); dupRemoval.setInSchema(projectionNode.getInSchema()); dupRemoval.setTargets(PlannerUtil.schemaToTargets(outSchema)); dupRemoval.setGroupingColumns(outSchema.toArray()); block.registerNode(dupRemoval); block.setAggregationRequire(); projectionNode.setChild(dupRemoval); projectionNode.setInSchema(dupRemoval.getOutSchema()); } }
sortNode.setInSchema(dupRemoval.getOutSchema()); sortNode.setOutSchema(dupRemoval.getOutSchema()); projectionNode.setInSchema(sortNode.getOutSchema()); projectionNode.setChild(sortNode); projectionNode.setInSchema(dupRemoval.getOutSchema());
private void insertDistinctOperator(LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode projectionNode, LogicalNode child) throws TajoException { if (projectionNode.getChild().getType() != NodeType.GROUP_BY) { Schema outSchema = projectionNode.getOutSchema(); GroupbyNode dupRemoval = plan.createNode(GroupbyNode.class); dupRemoval.setChild(child); dupRemoval.setInSchema(projectionNode.getInSchema()); dupRemoval.setTargets(PlannerUtil.schemaToTargets(outSchema)); dupRemoval.setGroupingColumns(outSchema.toArray()); block.registerNode(dupRemoval); block.setAggregationRequire(); projectionNode.setChild(dupRemoval); projectionNode.setInSchema(dupRemoval.getOutSchema()); } }
sortNode.setInSchema(dupRemoval.getOutSchema()); sortNode.setOutSchema(dupRemoval.getOutSchema()); projectionNode.setInSchema(sortNode.getOutSchema()); projectionNode.setChild(sortNode); projectionNode.setInSchema(dupRemoval.getOutSchema());
private ExecutionBlock buildTwoPhaseGroupby(MasterPlan masterPlan, ExecutionBlock latestBlock, GroupbyNode firstPhaseGroupby, GroupbyNode secondPhaseGroupby) throws TajoException { ExecutionBlock childBlock = latestBlock; childBlock.setPlan(firstPhaseGroupby); ExecutionBlock currentBlock = masterPlan.newExecutionBlock(); DataChannel channel; if (firstPhaseGroupby.isEmptyGrouping()) { channel = new DataChannel(childBlock, currentBlock, HASH_SHUFFLE, 1); channel.setShuffleKeys(firstPhaseGroupby.getGroupingColumns()); } else { channel = new DataChannel(childBlock, currentBlock, HASH_SHUFFLE, 32); channel.setShuffleKeys(firstPhaseGroupby.getGroupingColumns()); } channel.setSchema(firstPhaseGroupby.getOutSchema()); channel.setDataFormat(dataFormat); ScanNode scanNode = buildInputExecutor(masterPlan.getLogicalPlan(), channel); secondPhaseGroupby.setChild(scanNode); secondPhaseGroupby.setInSchema(scanNode.getOutSchema()); currentBlock.setPlan(secondPhaseGroupby); masterPlan.addConnect(channel); return currentBlock; }
private ExecutionBlock buildTwoPhaseGroupby(MasterPlan masterPlan, ExecutionBlock latestBlock, GroupbyNode firstPhaseGroupby, GroupbyNode secondPhaseGroupby) throws TajoException { ExecutionBlock childBlock = latestBlock; childBlock.setPlan(firstPhaseGroupby); ExecutionBlock currentBlock = masterPlan.newExecutionBlock(); DataChannel channel; if (firstPhaseGroupby.isEmptyGrouping()) { channel = new DataChannel(childBlock, currentBlock, HASH_SHUFFLE, 1); channel.setShuffleKeys(firstPhaseGroupby.getGroupingColumns()); } else { channel = new DataChannel(childBlock, currentBlock, HASH_SHUFFLE, 32); channel.setShuffleKeys(firstPhaseGroupby.getGroupingColumns()); } channel.setSchema(firstPhaseGroupby.getOutSchema()); channel.setDataFormat(dataFormat); ScanNode scanNode = buildInputExecutor(masterPlan.getLogicalPlan(), channel); secondPhaseGroupby.setChild(scanNode); secondPhaseGroupby.setInSchema(scanNode.getOutSchema()); currentBlock.setPlan(secondPhaseGroupby); masterPlan.addConnect(channel); return currentBlock; }
dataChannel.setShuffle(HASH_SHUFFLE, firstPhaseGroupBy.getGroupingColumns(), 32); dataChannel.setSchema(firstPhaseGroupBy.getOutSchema()); ExecutionBlock childBlock = masterPlan.getExecBlock(dataChannel.getSrcId());
dataChannel.setShuffle(HASH_SHUFFLE, firstPhaseGroupBy.getGroupingColumns(), 32); dataChannel.setSchema(firstPhaseGroupBy.getOutSchema()); ExecutionBlock childBlock = masterPlan.getExecBlock(dataChannel.getSrcId());