use of io.trino.spi.function.WindowFunctionSignature in project trino by trinodb.
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(type -> parseTypeSignature(type, ImmutableSet.of())).collect(toImmutableList());
Signature signature = new Signature(window.name(), typeVariables, ImmutableList.of(), parseTypeSignature(window.returnType(), ImmutableSet.of()), argumentTypes, false);
Optional<String> description = Optional.ofNullable(clazz.getAnnotation(Description.class)).map(Description::value);
boolean deprecated = clazz.getAnnotationsByType(Deprecated.class).length > 0;
return new SqlWindowFunction(signature, description, deprecated, new ReflectionWindowFunctionSupplier(window.argumentTypes().length, clazz));
}
Aggregations