use of org.apache.flink.table.functions.BuiltInFunctionDefinitions.JSON_STRING in project flink by apache.
the class WrapJsonAggFunctionArgumentsRule method addProjections.
/**
* Adds (wrapped) projections for affected arguments of the aggregation.
*
* <p>Note that we cannot override any of the projections as a field may be used multiple times,
* and in particular outside of the aggregation call. Therefore, we explicitly add the wrapped
* projection as an additional one.
*/
private void addProjections(RelOptCluster cluster, RelBuilder relBuilder, List<Integer> affectedArgs) {
final BridgingSqlFunction operandToStringOperator = of(cluster, JSON_STRING);
final List<RexNode> projects = new ArrayList<>();
affectedArgs.stream().map(argIdx -> relBuilder.call(operandToStringOperator, relBuilder.field(argIdx))).forEach(projects::add);
relBuilder.projectPlus(projects);
}
Aggregations