### Question:
DoubleHistogramAggregation { @CombineFunction public static void merge(@AggregationState State state, State other) { NumericHistogram input = other.get(); NumericHistogram previous = state.get(); if (previous == null) { state.set(input); } else { previous.mergeWith(input); } } private  DoubleHistogramAggregation(); @InputFunction static void add(@AggregationState State state, @SqlType(BIGINT) long buckets, @SqlType(DOUBLE) double value, @SqlType(DOUBLE) double weight); @InputFunction static void add(@AggregationState State state, @SqlType(BIGINT) long buckets, @SqlType(DOUBLE) double value); @CombineFunction static void merge(@AggregationState State state, State other); @OutputFunction("map(double,double)") static void output(@AggregationState State state, BlockBuilder out); static final int ENTRY_BUFFER_SIZE; }### Answer:
@Test public void testMerge() { Accumulator singleStep = factory.createAccumulator(); singleStep.addInput(input); Block singleStepResult = getFinalBlock(singleStep); Accumulator partialStep = factory.createAccumulator(); partialStep.addInput(input); Block intermediate = getIntermediateBlock(partialStep); Accumulator finalStep = factory.createAccumulator(); finalStep.addIntermediate(intermediate); finalStep.addIntermediate(intermediate); Block actual = getFinalBlock(finalStep); Map<Double, Double> expected = Maps.transformValues(extractSingleValue(singleStepResult), value -> value * 2); assertEquals(extractSingleValue(actual), expected); }