@Test public void testGetSerializedType() { AccumulatorStateSerializer<LongState> serializer = StateCompiler.generateStateSerializer(LongState.class); assertEquals(serializer.getSerializedType(), BIGINT); }
@Test public void testGetSerializedType() { AccumulatorStateSerializer<LongState> serializer = StateCompiler.generateStateSerializer(LongState.class); assertEquals(serializer.getSerializedType(), BIGINT); }
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 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 static InternalAggregationFunction generateAggregation(Type type, 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); 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 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); }
private static InternalAggregationFunction generateAggregation(Type type, 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); 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 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); }
type); Type intermediateType = stateSerializer.getSerializedType(); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), type, true, false, factory);
type); Type intermediateType = stateSerializer.getSerializedType(); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), type, true, false, factory);
ImmutableList.of(REAL), ImmutableList.of( longStateSerializer.getSerializedType(), doubleStateSerializer.getSerializedType()), REAL, true,
ImmutableList.of(REAL), ImmutableList.of( longStateSerializer.getSerializedType(), doubleStateSerializer.getSerializedType()), REAL, true,
Type intermediateType = stateSerializer.getSerializedType(); List<ParameterMetadata> inputParameterMetadata = createInputParameterMetadata(type); AggregationMetadata metadata = new AggregationMetadata(
Type intermediateType = stateSerializer.getSerializedType(); List<ParameterMetadata> inputParameterMetadata = createInputParameterMetadata(type); AggregationMetadata metadata = new AggregationMetadata(
Type intermediateType = stateSerializer.getSerializedType();
Type intermediateType = stateSerializer.getSerializedType();
ImmutableList.of(stateSerializer.getSerializedType()), outputType, details.isDecomposable(),
ImmutableList.of(stateSerializer.getSerializedType()), outputType, details.isDecomposable(),
Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(getSignature().getName(), type.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())),
Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(getSignature().getName(), type.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())),