public static void inputDouble(QuantileDigestState state, double value, long weight, double accuracy) { inputBigint(state, doubleToSortableLong(value), weight, accuracy); }
public static ParameterMetadata fromSqlType(Type sqlType, boolean isBlock, boolean isNullable, String methodName) { return new ParameterMetadata(inputChannelParameterType(isNullable, isBlock, methodName), sqlType); }
@Override public Type getFinalType() { return accumulator.getFinalType(); }
@Test(expectedExceptions = PrestoException.class) public void testBadNumberOfBuckets() { Accumulator singleStep = factory.createAccumulator(); singleStep.addInput(makeInput(0)); getFinalBlock(singleStep); }
@Test(expectedExceptions = PrestoException.class) public void testBadNumberOfBuckets() { Accumulator singleStep = factory.createAccumulator(); singleStep.addInput(makeInput(0)); getFinalBlock(singleStep); }
private long estimateCount(List<?> values, double maxStandardError) { Object result = AggregationTestUtils.aggregation(getAggregationFunction(), createPage(values, maxStandardError)); return (long) result; }
private long estimateCountPartial(List<?> values, double maxStandardError) { Object result = AggregationTestUtils.partialAggregation(getAggregationFunction(), createPage(values, maxStandardError)); return (long) result; }
private long estimateGroupByCount(List<?> values, double maxStandardError) { Object result = AggregationTestUtils.groupedAggregation(getAggregationFunction(), createPage(values, maxStandardError)); return (long) result; }
public static GenericAccumulatorFactoryBinder generateAccumulatorFactoryBinder(AggregationMetadata metadata, DynamicClassLoader classLoader) { Class<? extends Accumulator> accumulatorClass = generateAccumulatorClass( Accumulator.class, metadata, classLoader); Class<? extends GroupedAccumulator> groupedAccumulatorClass = generateAccumulatorClass( GroupedAccumulator.class, metadata, classLoader); return new GenericAccumulatorFactoryBinder( metadata.getAccumulatorStateDescriptors(), accumulatorClass, groupedAccumulatorClass); }
private static void testBigint(Block longBlock, int expectedSetSize) { TypedSet typedSet = new TypedSet(BIGINT, expectedSetSize, FUNCTION_NAME); testBigintFor(typedSet, longBlock); BlockBuilder emptyBlockBuilder = BIGINT.createBlockBuilder(null, expectedSetSize); TypedSet typedSetWithPassedInBuilder = new TypedSet(BIGINT, emptyBlockBuilder, expectedSetSize, FUNCTION_NAME); testBigintFor(typedSetWithPassedInBuilder, longBlock); }
protected void testAggregation(Object expectedValue, Block... blocks) { assertAggregation(getFunction(), expectedValue, blocks); } }
private Page[] getPages() { Page[] pages = this.pages; if (isReversed) { pages = AggregationTestUtils.reverseColumns(pages); } if (offset > 0) { pages = AggregationTestUtils.offsetColumns(pages, offset); } return pages; }
public static AggregationImplementation parseImplementation( Class<?> aggregationDefinition, AggregationHeader header, Class<?> stateClass, Method inputFunction, Method outputFunction, Method combineFunction, Optional<Method> stateSerializerFactoryFunction) { return new Parser(aggregationDefinition, header, stateClass, inputFunction, outputFunction, combineFunction, stateSerializerFactoryFunction).get(); }
@Override public DoubleHistogramAggregation.State createSingleState() { return new SingleState(); }
public long getEstimatedSize() { return aggregation.getEstimatedSize(); } }
public void popAll(BlockBuilder resultBlockBuilder) { while (positionCount > 0) { pop(resultBlockBuilder); } }
private void remove() { positionCount--; heapIndex[0] = heapIndex[positionCount]; siftDown(); }
public void popAll(BlockBuilder resultBlockBuilder) { while (positionCount > 0) { pop(resultBlockBuilder); } }
public static int[] offsetArgs(InternalAggregationFunction function, int offset) { int[] args = createArgs(function); for (int i = 0; i < args.length; i++) { args[i] += offset; } return args; }
@Override public Type getFinalType() { return accumulator.getFinalType(); }