Search in sources :

Example 6 with AggregationFunction

use of com.facebook.presto.spi.function.AggregationFunction in project presto by prestodb.

the class AggregationFromAnnotationsParser method getNames.

private static List<String> getNames(@Nullable AnnotatedElement outputFunction, AggregationFunction aggregationAnnotation) {
    List<String> defaultNames = ImmutableList.<String>builder().add(aggregationAnnotation.value()).addAll(Arrays.asList(aggregationAnnotation.alias())).build();
    if (outputFunction == null) {
        return defaultNames;
    }
    AggregationFunction annotation = outputFunction.getAnnotation(AggregationFunction.class);
    if (annotation == null) {
        return defaultNames;
    } else {
        return ImmutableList.<String>builder().add(annotation.value()).addAll(Arrays.asList(annotation.alias())).build();
    }
}
Also used : AggregationFunction(com.facebook.presto.spi.function.AggregationFunction)

Aggregations

AggregationFunction (com.facebook.presto.spi.function.AggregationFunction)6 ImmutableList (com.google.common.collect.ImmutableList)3 Method (java.lang.reflect.Method)3 DynamicClassLoader (com.facebook.presto.bytecode.DynamicClassLoader)2 Signature (com.facebook.presto.metadata.Signature)2 TypeSignature (com.facebook.presto.spi.type.TypeSignature)2 ImmutableCollectors.toImmutableList (com.facebook.presto.util.ImmutableCollectors.toImmutableList)2 BoundVariables (com.facebook.presto.metadata.BoundVariables)1 FunctionRegistry (com.facebook.presto.metadata.FunctionRegistry)1 LongVariableConstraint (com.facebook.presto.metadata.LongVariableConstraint)1 SignatureBinder.applyBoundVariables (com.facebook.presto.metadata.SignatureBinder.applyBoundVariables)1 SqlAggregationFunction (com.facebook.presto.metadata.SqlAggregationFunction)1 AggregationCompiler.isParameterBlock (com.facebook.presto.operator.aggregation.AggregationCompiler.isParameterBlock)1 AggregationCompiler.isParameterNullable (com.facebook.presto.operator.aggregation.AggregationCompiler.isParameterNullable)1 ParameterMetadata (com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata)1 BLOCK_INDEX (com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.BLOCK_INDEX)1 STATE (com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.STATE)1 ParameterMetadata.fromSqlType (com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata.fromSqlType)1 AggregationUtils.generateAggregationName (com.facebook.presto.operator.aggregation.AggregationUtils.generateAggregationName)1 StateCompiler (com.facebook.presto.operator.aggregation.state.StateCompiler)1