Interface UserDefinedSqlAggregationFunction.INeedSqlExpressionProvidersBuilder

Enclosing class:
UserDefinedSqlAggregationFunction

public static interface UserDefinedSqlAggregationFunction.INeedSqlExpressionProvidersBuilder
Builder for expressions providers.
  • Method Details Link icon

    • sqlExpressionProviders Link icon

      UserDefinedSqlAggregationFunction.INeedOutputTypesBuilder sqlExpressionProviders(@NonNull @NonNull List<Function<List<String>,String>> sqlExpressionProviders)
      Defines the list of function providing the sql expressions from the input column names.

      For a sum products function.

      
       UserDefinedSqlAggregationFunction.builder()
               .pluginKey("MY_SUM_PRODUCT")
               .inputsNumber(2)
               .sqlExpressionProviders(
                   List.of(
                       sqlColumnNames ->
                           "SUM(" + sqlColumnNames.get(0) + " * " + sqlColumnNames.get(1) + ")"))
               .outputTypes(List.of(StandardTypes.DOUBLE))
               .build();
      
       

      There is two inputs columns on the sum product function, these two columns are multiplied together and then aggregated with a sum producing one output.

      These two inputs columns are passed to all the expressions providers, so they can provide the Sql expressions needed by the external database to compute the output.

      For a sum product function there is only one output so there is only one Sql expression provider defined.