@Override public void evaluateFinal(int groupId, BlockBuilder output) { accumulator.evaluateFinal(groupId, output); }
@Override public void evaluateFinal(int groupId, BlockBuilder output) { accumulator.evaluateFinal(groupId, output); }
public void evaluate(int groupId, BlockBuilder output) { if (step.isOutputPartial()) { aggregation.evaluateIntermediate(groupId, output); } else { aggregation.evaluateFinal(groupId, output); } }
public static Block getFinalBlock(GroupedAccumulator accumulator) { BlockBuilder blockBuilder = accumulator.getFinalType().createBlockBuilder(null, 1000); accumulator.evaluateFinal(0, blockBuilder); return blockBuilder.build(); }
@Test public void testEmptyStateOutputIsNull() { InternalAggregationFunction aggregationFunction = getInternalAggregationFunction(BIGINT, BIGINT); GroupedAccumulator groupedAccumulator = aggregationFunction.bind(Ints.asList(), Optional.empty()).createGroupedAccumulator(); BlockBuilder blockBuilder = groupedAccumulator.getFinalType().createBlockBuilder(null, 1); groupedAccumulator.evaluateFinal(0, blockBuilder); assertTrue(blockBuilder.isNull(0)); }
@Test public void testEmptyHistogramOutputsNull() { InternalAggregationFunction function = getInternalDefaultVarCharAggregationn(); GroupedAccumulator groupedAccumulator = function.bind(Ints.asList(new int[] {}), Optional.empty()) .createGroupedAccumulator(); BlockBuilder blockBuilder = groupedAccumulator.getFinalType().createBlockBuilder(null, 1000); groupedAccumulator.evaluateFinal(0, blockBuilder); assertTrue(blockBuilder.isNull(0)); }
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()); }
@Test public void testEmptyStateOutputsNull() { InternalAggregationFunction bigIntAgg = metadata.getFunctionRegistry().getAggregateFunctionImplementation( new Signature("array_agg", AGGREGATE, parseTypeSignature("array(bigint)"), parseTypeSignature(StandardTypes.BIGINT))); GroupedAccumulator groupedAccumulator = bigIntAgg.bind(Ints.asList(new int[] {}), Optional.empty()) .createGroupedAccumulator(); BlockBuilder blockBuilder = groupedAccumulator.getFinalType().createBlockBuilder(null, 1000); groupedAccumulator.evaluateFinal(0, blockBuilder); assertTrue(blockBuilder.isNull(0)); }
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()); } }
public void evaluate(int groupId, BlockBuilder output) { if (step.isOutputPartial()) { aggregation.evaluateIntermediate(groupId, output); } else { aggregation.evaluateFinal(groupId, output); } } }
public static Block getFinalBlock(GroupedAccumulator accumulator) { BlockBuilder blockBuilder = accumulator.getFinalType().createBlockBuilder(new BlockBuilderStatus(), 1000); accumulator.evaluateFinal(0, blockBuilder); return blockBuilder.build(); }
private static Object getGroupValue(GroupedAccumulator groupedAggregation, int groupId) { BlockBuilder out = groupedAggregation.getFinalType().createBlockBuilder(new BlockBuilderStatus(), 1); groupedAggregation.evaluateFinal(groupId, out); return BlockAssertions.getOnlyValue(groupedAggregation.getFinalType(), out.build()); }