public LazyAccumulatorFactoryBinder(AggregationMetadata metadata, DynamicClassLoader classLoader) { binder = Suppliers.memoize(() -> new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader)); }
private static InternalAggregationFunction generateAggregation(Type type) { DynamicClassLoader classLoader = new DynamicClassLoader(CountColumn.class.getClassLoader()); AccumulatorStateSerializer<LongState> stateSerializer = new StateCompiler().generateStateSerializer(LongState.class, classLoader); AccumulatorStateFactory<LongState> stateFactory = new StateCompiler().generateStateFactory(LongState.class, classLoader); Type intermediateType = stateSerializer.getSerializedType(); List<Type> inputTypes = ImmutableList.of(type); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, BIGINT, inputTypes), createInputParameterMetadata(type), INPUT_FUNCTION, null, null, COMBINE_FUNCTION, OUTPUT_FUNCTION, LongState.class, stateSerializer, stateFactory, BIGINT, false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, intermediateType, BIGINT, true, false, factory); }
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType) { DynamicClassLoader classLoader = new DynamicClassLoader(MapAggregationFunction.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(keyType, valueType); Type outputType = new MapType(keyType, valueType); KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(keyType, valueType, false); Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType, inputTypes), createInputParameterMetadata(keyType, valueType), INPUT_FUNCTION.bindTo(keyType).bindTo(valueType), null, null, COMBINE_FUNCTION, OUTPUT_FUNCTION, KeyValuePairsState.class, stateSerializer, new KeyValuePairsStateFactory(keyType, valueType), outputType, false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, intermediateType, outputType, true, false, factory); }
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, inputTypes), createInputParameterMetadata(type), INPUT_FUNCTION.bindTo(type), null, null, COMBINE_FUNCTION, OUTPUT_FUNCTION, NullableLongState.class, new StateCompiler().generateStateSerializer(NullableLongState.class, classLoader), new StateCompiler().generateStateFactory(NullableLongState.class, classLoader), VARBINARY, false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, BIGINT, VARBINARY, true, false, factory); }
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType) { DynamicClassLoader classLoader = new DynamicClassLoader(MultimapAggregationFunction.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(keyType, valueType); Type outputType = new MapType(keyType, new ArrayType(valueType)); KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(keyType, valueType, true); Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType, inputTypes), createInputParameterMetadata(keyType, valueType), INPUT_FUNCTION, null, null, COMBINE_FUNCTION, OUTPUT_FUNCTION, KeyValuePairsState.class, stateSerializer, new KeyValuePairsStateFactory(keyType, valueType), outputType, false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, intermediateType, outputType, true, false, factory); }
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType) { DynamicClassLoader classLoader = new DynamicClassLoader(Histogram.class.getClassLoader()); List<Type> inputTypes = ImmutableList.of(keyType); Type outputType = new MapType(keyType, valueType); HistogramStateSerializer stateSerializer = new HistogramStateSerializer(keyType); Type intermediateType = stateSerializer.getSerializedType(); MethodHandle inputFunction = INPUT_FUNCTION.bindTo(keyType); MethodHandle outputFunction = OUTPUT_FUNCTION.bindTo(outputType); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType, inputTypes), createInputParameterMetadata(keyType), inputFunction, null, null, COMBINE_FUNCTION, outputFunction, HistogramState.class, stateSerializer, new HistogramStateFactory(), outputType, false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, 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, inputTypes), inputParameterMetadata, INPUT_FUNCTION.bindTo(comparator).bindTo(type), null, null, COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(outputType), MinMaxNState.class, stateSerializer, new MinMaxNStateFactory(), outputType, false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(getSignature().getName(), inputTypes, intermediateType, outputType, true, false, factory); }
private static InternalAggregationFunction generateAggregation(Type type) { DynamicClassLoader classLoader = new DynamicClassLoader(ArrayAggregationFunction.class.getClassLoader()); AccumulatorStateSerializer<?> stateSerializer = new ArrayAggregationStateSerializer(type); AccumulatorStateFactory<?> stateFactory = new ArrayAggregationStateFactory(); List<Type> inputTypes = ImmutableList.of(type); Type outputType = new ArrayType(type); Type intermediateType = stateSerializer.getSerializedType(); List<ParameterMetadata> inputParameterMetadata = createInputParameterMetadata(type); MethodHandle inputFunction = INPUT_FUNCTION.bindTo(type); MethodHandle combineFunction = COMBINE_FUNCTION.bindTo(type); MethodHandle outputFunction = OUTPUT_FUNCTION.bindTo(outputType); Class<? extends AccumulatorState> stateInterface = ArrayAggregationState.class; AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, type, inputTypes), inputParameterMetadata, inputFunction, null, null, combineFunction, outputFunction, stateInterface, stateSerializer, stateFactory, outputType, false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, intermediateType, outputType, true, false, factory); }
private InternalAggregationFunction generateAggregation(Type valueType, Type keyType) { DynamicClassLoader classLoader = new DynamicClassLoader(getClass().getClassLoader()); MaxOrMinByStateSerializer stateSerializer = new MaxOrMinByStateSerializer(valueType, keyType); Type intermediateType = stateSerializer.getSerializedType(); List<Type> inputTypes = ImmutableList.of(valueType, keyType); MaxOrMinByStateFactory stateFactory = new MaxOrMinByStateFactory(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(getSignature().getName(), valueType, inputTypes), createInputParameterMetadata(valueType, keyType), insertArguments(INPUT_FUNCTION, 0, min).bindTo(keyType), null, null, insertArguments(COMBINE_FUNCTION, 0, min).bindTo(keyType), OUTPUT_FUNCTION.bindTo(valueType), MaxOrMinByState.class, stateSerializer, stateFactory, valueType, false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(getSignature().getName(), inputTypes, intermediateType, valueType, true, false, factory); }
false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(name, inputTypes, intermediateType, outputType, true, false, factory);
false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, intermediateType, type, true, false, factory);
false); GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(getSignature().getName(), inputTypes, intermediateType, type, true, false, factory);