Search in sources :

Example 1 with WindowFunctionSignature

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

the class WindowAnnotationsParser method parse.

private static SqlWindowFunction parse(Class<? extends WindowFunction> clazz, WindowFunctionSignature window) {
    List<TypeVariableConstraint> typeVariables = ImmutableList.of();
    if (!window.typeVariable().isEmpty()) {
        typeVariables = ImmutableList.of(typeVariable(window.typeVariable()));
    }
    List<TypeSignature> argumentTypes = Stream.of(window.argumentTypes()).map(TypeSignature::parseTypeSignature).collect(toImmutableList());
    Signature signature = new Signature(window.name(), WINDOW, typeVariables, ImmutableList.of(), parseTypeSignature(window.returnType()), argumentTypes, false);
    return new SqlWindowFunction(new ReflectionWindowFunctionSupplier<>(signature, clazz));
}
Also used : TypeSignature(com.facebook.presto.spi.type.TypeSignature) TypeSignature.parseTypeSignature(com.facebook.presto.spi.type.TypeSignature.parseTypeSignature) TypeSignature(com.facebook.presto.spi.type.TypeSignature) WindowFunctionSignature(com.facebook.presto.spi.function.WindowFunctionSignature) Signature(com.facebook.presto.metadata.Signature) TypeSignature.parseTypeSignature(com.facebook.presto.spi.type.TypeSignature.parseTypeSignature) TypeVariableConstraint(com.facebook.presto.metadata.TypeVariableConstraint)

Aggregations

Signature (com.facebook.presto.metadata.Signature)1 TypeVariableConstraint (com.facebook.presto.metadata.TypeVariableConstraint)1 WindowFunctionSignature (com.facebook.presto.spi.function.WindowFunctionSignature)1 TypeSignature (com.facebook.presto.spi.type.TypeSignature)1 TypeSignature.parseTypeSignature (com.facebook.presto.spi.type.TypeSignature.parseTypeSignature)1