Search in sources :

Example 1 with ParameterInfo

use of io.confluent.ksql.function.ParameterInfo in project ksql by confluentinc.

the class DescribeFunctionExecutor method getFunctionInfo.

private static FunctionInfo getFunctionInfo(final List<ParameterInfo> argTypes, final ParamType returnTypeSchema, final String description, final boolean variadic) {
    final List<ArgumentInfo> args = new ArrayList<>();
    for (int i = 0; i < argTypes.size(); i++) {
        final ParameterInfo param = argTypes.get(i);
        final boolean isVariadic = variadic && i == (argTypes.size() - 1);
        final String type = isVariadic ? ((ArrayType) param.type()).element().toString() : param.type().toString();
        args.add(new ArgumentInfo(param.name(), type, param.description(), isVariadic));
    }
    return new FunctionInfo(args, returnTypeSchema.toString(), description);
}
Also used : ArrayType(io.confluent.ksql.function.types.ArrayType) ArrayList(java.util.ArrayList) FunctionInfo(io.confluent.ksql.rest.entity.FunctionInfo) ParameterInfo(io.confluent.ksql.function.ParameterInfo) ArgumentInfo(io.confluent.ksql.rest.entity.ArgumentInfo)

Aggregations

ParameterInfo (io.confluent.ksql.function.ParameterInfo)1 ArrayType (io.confluent.ksql.function.types.ArrayType)1 ArgumentInfo (io.confluent.ksql.rest.entity.ArgumentInfo)1 FunctionInfo (io.confluent.ksql.rest.entity.FunctionInfo)1 ArrayList (java.util.ArrayList)1