public LazyAccumulatorFactoryBinder(AggregationMetadata metadata, DynamicClassLoader classLoader) { binder = Suppliers.memoize(() -> AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader)); }
private static InternalAggregationFunction generateAggregation(Type type) { DynamicClassLoader classLoader = new DynamicClassLoader(ChecksumAggregationFunction.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(type); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, type.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(type), INPUT_FUNCTION.bindTo(type), COMBINE_FUNCTION, OUTPUT_FUNCTION, ImmutableList.of(new AccumulatorStateDescriptor( NullableLongState.class, StateCompiler.generateStateSerializer(NullableLongState.class, classLoader), StateCompiler.generateStateFactory(NullableLongState.class, classLoader))), VARBINARY); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(BIGINT), VARBINARY, true, false, factory); }
private static InternalAggregationFunction generateAggregation(Type type) { DynamicClassLoader classLoader = new DynamicClassLoader(CountColumn.class.getClassLoader()); AccumulatorStateSerializer<LongState> stateSerializer = StateCompiler.generateStateSerializer(LongState.class, classLoader); AccumulatorStateFactory<LongState> stateFactory = StateCompiler.generateStateFactory(LongState.class, classLoader); Type intermediateType = stateSerializer.getSerializedType(); List<Type> inputTypes = ImmutableList.of(type); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, BIGINT.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(type), INPUT_FUNCTION, COMBINE_FUNCTION, OUTPUT_FUNCTION, ImmutableList.of(new AccumulatorStateDescriptor( LongState.class, stateSerializer, stateFactory)), BIGINT); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), BIGINT, true, false, factory); }
private InternalAggregationFunction generateAggregation(Type keyType, Type valueType, Type outputType) { DynamicClassLoader classLoader = new DynamicClassLoader(MultimapAggregationFunction.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(keyType, valueType); MultimapAggregationStateSerializer stateSerializer = new MultimapAggregationStateSerializer(keyType, valueType); Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(keyType, valueType), INPUT_FUNCTION, COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(keyType).bindTo(valueType), ImmutableList.of(new AccumulatorStateDescriptor( MultimapAggregationState.class, stateSerializer, new MultimapAggregationStateFactory(keyType, valueType, groupMode))), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory); }
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType, MapType outputType) { DynamicClassLoader classLoader = new DynamicClassLoader(MapUnionAggregation.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(outputType); KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(outputType); Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(outputType), INPUT_FUNCTION.bindTo(keyType).bindTo(valueType), COMBINE_FUNCTION, OUTPUT_FUNCTION, ImmutableList.of(new AccumulatorStateDescriptor( KeyValuePairsState.class, stateSerializer, new KeyValuePairsStateFactory(keyType, valueType))), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, false, factory); }
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType, MapType outputType) { DynamicClassLoader classLoader = new DynamicClassLoader(MapAggregationFunction.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(keyType, valueType); KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(outputType); Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(keyType, valueType), INPUT_FUNCTION.bindTo(keyType).bindTo(valueType), COMBINE_FUNCTION, OUTPUT_FUNCTION, ImmutableList.of(new AccumulatorStateDescriptor( KeyValuePairsState.class, stateSerializer, new KeyValuePairsStateFactory(keyType, valueType))), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory); }
private static InternalAggregationFunction generateAggregation( String functionName, Type keyType, Type outputType, HistogramGroupImplementation groupMode) { DynamicClassLoader classLoader = new DynamicClassLoader(Histogram.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(keyType); HistogramStateSerializer stateSerializer = new HistogramStateSerializer(keyType, outputType); Type intermediateType = stateSerializer.getSerializedType(); MethodHandle inputFunction = INPUT_FUNCTION.bindTo(keyType); MethodHandle outputFunction = OUTPUT_FUNCTION.bindTo(outputType); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(functionName, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(keyType), inputFunction, COMBINE_FUNCTION, outputFunction, ImmutableList.of(new AccumulatorStateDescriptor( HistogramState.class, stateSerializer, new HistogramStateFactory(keyType, EXPECTED_SIZE_FOR_HASHING, groupMode))), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(functionName, inputTypes, ImmutableList.of(intermediateType), outputType, true, false, factory); }
private static InternalAggregationFunction generateAggregation(Type valueType, QuantileDigestType outputType, int arity) { DynamicClassLoader classLoader = new DynamicClassLoader(QuantileDigestAggregationFunction.class.getClassLoader()); List<Type> inputTypes = getInputTypes(valueType, arity); QuantileDigestStateSerializer stateSerializer = new QuantileDigestStateSerializer(valueType); Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(inputTypes), getMethodHandle(valueType, arity), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor( QuantileDigestState.class, stateSerializer, new QuantileDigestStateFactory())), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory); }
private static InternalAggregationFunction generateAggregation(Type type, boolean legacyArrayAgg, ArrayAggGroupImplementation groupMode) { DynamicClassLoader classLoader = new DynamicClassLoader(ArrayAggregationFunction.class.getClassLoader()); AccumulatorStateSerializer<?> stateSerializer = new ArrayAggregationStateSerializer(type); AccumulatorStateFactory<?> stateFactory = new ArrayAggregationStateFactory(type, groupMode); List<Type> inputTypes = ImmutableList.of(type); Type outputType = new ArrayType(type); Type intermediateType = stateSerializer.getSerializedType(); List<ParameterMetadata> inputParameterMetadata = createInputParameterMetadata(type, legacyArrayAgg); MethodHandle inputFunction = INPUT_FUNCTION.bindTo(type); MethodHandle combineFunction = COMBINE_FUNCTION.bindTo(type); MethodHandle outputFunction = OUTPUT_FUNCTION.bindTo(type); Class<? extends AccumulatorState> stateInterface = ArrayAggregationState.class; AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, type.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), inputParameterMetadata, inputFunction, combineFunction, outputFunction, ImmutableList.of(new AccumulatorStateDescriptor( stateInterface, stateSerializer, stateFactory)), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory); }
private static InternalAggregationFunction generateAggregation(Type valueType, QuantileDigestType type) { DynamicClassLoader classLoader = new DynamicClassLoader(MapAggregationFunction.class.getClassLoader()); QuantileDigestStateSerializer stateSerializer = new QuantileDigestStateSerializer(valueType); Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, type.getTypeSignature(), ImmutableList.of(type.getTypeSignature())), createInputParameterMetadata(type), INPUT_FUNCTION.bindTo(type), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor( QuantileDigestState.class, stateSerializer, new QuantileDigestStateFactory())), type); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, ImmutableList.of(type), ImmutableList.of(intermediateType), type, true, true, factory); }
private static InternalAggregationFunction generateAggregation(Type inputType, Type outputType) { checkArgument(inputType instanceof DecimalType, "type must be Decimal"); DynamicClassLoader classLoader = new DynamicClassLoader(DecimalSumAggregation.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(inputType); MethodHandle inputFunction; Class<? extends AccumulatorState> stateInterface = LongDecimalWithOverflowState.class; AccumulatorStateSerializer<?> stateSerializer = new LongDecimalWithOverflowStateSerializer(); if (((DecimalType) inputType).isShort()) { inputFunction = SHORT_DECIMAL_INPUT_FUNCTION; } else { inputFunction = LONG_DECIMAL_INPUT_FUNCTION; } AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(inputType), inputFunction.bindTo(inputType), COMBINE_FUNCTION, LONG_DECIMAL_OUTPUT_FUNCTION.bindTo(outputType), ImmutableList.of(new AccumulatorStateDescriptor( stateInterface, stateSerializer, new LongDecimalWithOverflowStateFactory())), outputType); Type intermediateType = stateSerializer.getSerializedType(); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, false, factory); }
GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), type, true, false, factory);
outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(name, inputTypes, ImmutableList.of(intermediateType), outputType, true, false, factory);
protected InternalAggregationFunction generateAggregation(Type type) { DynamicClassLoader classLoader = new DynamicClassLoader(AbstractMinMaxNAggregationFunction.class.getClassLoader()); BlockComparator comparator = typeToComparator.apply(type); List<Type> inputTypes = ImmutableList.of(type, BIGINT); MinMaxNStateSerializer stateSerializer = new MinMaxNStateSerializer(comparator, type); Type intermediateType = stateSerializer.getSerializedType(); ArrayType outputType = new ArrayType(type); List<ParameterMetadata> inputParameterMetadata = ImmutableList.of( new ParameterMetadata(STATE), new ParameterMetadata(BLOCK_INPUT_CHANNEL, type), new ParameterMetadata(INPUT_CHANNEL, BIGINT), new ParameterMetadata(BLOCK_INDEX)); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(getSignature().getName(), type.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), inputParameterMetadata, INPUT_FUNCTION.bindTo(comparator).bindTo(type), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(outputType), ImmutableList.of(new AccumulatorStateDescriptor( MinMaxNState.class, stateSerializer, new MinMaxNStateFactory())), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(getSignature().getName(), inputTypes, ImmutableList.of(intermediateType), outputType, true, false, factory); }
type); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), type, true, false, factory);
REAL); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction( NAME,
stateFactory)), valueType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(getSignature().getName(), inputTypes, ImmutableList.of(intermediateType), valueType, true, false, factory);
ImmutableList.of(BinaryFunctionInterface.class, BinaryFunctionInterface.class)); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction( getSignature().getName(),
type); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(getSignature().getName(), inputTypes, ImmutableList.of(intermediateType), type, true, false, factory);
public LazyAccumulatorFactoryBinder(AggregationMetadata metadata, DynamicClassLoader classLoader) { binder = Suppliers.memoize(() -> new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader)); }