public void processPage(GroupByIdBlock groupIds, Page page) { if (step.isInputRaw()) { aggregation.addInput(groupIds, page); } else { aggregation.addIntermediate(groupIds, page.getBlock(intermediateChannel)); } }
public void evaluate(int groupId, BlockBuilder output) { if (step.isOutputPartial()) { aggregation.evaluateIntermediate(groupId, output); } else { aggregation.evaluateFinal(groupId, output); } }
public Type getType() { if (step.isOutputPartial()) { return aggregation.getIntermediateType(); } else { return aggregation.getFinalType(); } }
private static Object getGroupValue(GroupedAccumulator groupedAggregation, int groupId) { BlockBuilder out = groupedAggregation.getFinalType().createBlockBuilder(null, 1); groupedAggregation.evaluateFinal(groupId, out); return BlockAssertions.getOnlyValue(groupedAggregation.getFinalType(), out.build()); } }
@Benchmark public GroupedAccumulator testSharedGroupWithLargeBlocksRunner(Data data) { GroupedAccumulator groupedAccumulator = data.groupedAccumulator; for (int i = 0; i < data.numGroups; i++) { GroupByIdBlock groupByIdBlock = data.groupByIdBlocks[i]; Page page = data.pages[i]; groupedAccumulator.addInput(groupByIdBlock, page); } return groupedAccumulator; }
public static Block getIntermediateBlock(GroupedAccumulator accumulator) { BlockBuilder blockBuilder = accumulator.getIntermediateType().createBlockBuilder(null, 1000); accumulator.evaluateIntermediate(0, blockBuilder); return blockBuilder.build(); }
@Override public void evaluateFinal(int groupId, BlockBuilder output) { accumulator.evaluateFinal(groupId, output); }
@Override public Type getFinalType() { return accumulator.getFinalType(); }
public Type getIntermediateType() { return aggregation.getIntermediateType(); } }
public long getEstimatedSize() { return aggregation.getEstimatedSize(); }
public void prepareFinal() { aggregation.prepareFinal(); }
public static Block getFinalBlock(GroupedAccumulator accumulator) { BlockBuilder blockBuilder = accumulator.getFinalType().createBlockBuilder(null, 1000); accumulator.evaluateFinal(0, blockBuilder); return blockBuilder.build(); }
@Benchmark public GroupedAccumulator testSharedGroupWithLargeBlocksRunner(Data data) { GroupedAccumulator groupedAccumulator = data.groupedAccumulator; for (int i = 0; i < data.numGroups; i++) { GroupByIdBlock groupByIdBlock = data.groupByIdBlocks[i]; Page page = data.pages[i]; groupedAccumulator.addInput(groupByIdBlock, page); } return groupedAccumulator; }
public static Block getIntermediateBlock(GroupedAccumulator accumulator) { BlockBuilder blockBuilder = accumulator.getIntermediateType().createBlockBuilder(null, 1000); accumulator.evaluateIntermediate(0, blockBuilder); return blockBuilder.build(); }
@Override public void evaluateFinal(int groupId, BlockBuilder output) { accumulator.evaluateFinal(groupId, output); }
@Override public Type getFinalType() { return accumulator.getFinalType(); }
public Type getIntermediateType() { return aggregation.getIntermediateType(); } }
public long getEstimatedSize() { return aggregation.getEstimatedSize(); }
public void prepareFinal() { aggregation.prepareFinal(); }
public static Object getGroupValue(GroupedAccumulator groupedAggregation, int groupId) { BlockBuilder out = groupedAggregation.getFinalType().createBlockBuilder(null, 1); groupedAggregation.evaluateFinal(groupId, out); return BlockAssertions.getOnlyValue(groupedAggregation.getFinalType(), out.build()); }