[FLINK-40095][table-planner] Fix JSON aggregation functions failing in group window aggregate#28682
[FLINK-40095][table-planner] Fix JSON aggregation functions failing in group window aggregate#28682xuyangzhong wants to merge 3 commits into
Conversation
…n group window aggregate
raminqaf
left a comment
There was a problem hiding this comment.
Thanks @xuyangzhong! I did a quick first pass.
| new FlinkLogicalWindowAggregate( | ||
| tableAgg.getCluster(), | ||
| tableAgg.getTraitSet(), | ||
| Collections.emptyList(), |
There was a problem hiding this comment.
Here and everywhere else please use List.of()
There was a problem hiding this comment.
Beside that, shouldn't we here also pass the hint?
There was a problem hiding this comment.
This is because FlinkLogicalWindowTableAggregate is not a hintable node.
|
Thanks for your review @raminqaf ! Updated |
raminqaf
left a comment
There was a problem hiding this comment.
Thanks for addressing! Left two nits. Should be good in the next round!
| val logicalWindowAgg = new LogicalWindowAggregate( | ||
| ts.getCluster, | ||
| ts.getTraitSet, | ||
| util.List.of(), |
There was a problem hiding this comment.
nit:
| util.List.of(), | |
| List.of(), |
There was a problem hiding this comment.
Thanks for verifying this! It is okay like this.
|
Hi, @raminqaf could you please take another look again? Please let me know if you have any other concerns. |
raminqaf
left a comment
There was a problem hiding this comment.
@xuyangzhong Thanks for applying the feedback so fast. LGTM!

What is the purpose of the change
This pull request fixes JSON aggregation functions (JSON_OBJECTAGG / JSON_ARRAYAGG) failing when used in a group window aggregate (e.g. GROUP BY TUMBLE(...)). Previously, WrapJsonAggFunctionArgumentsRule only matched LogicalAggregate, so JSON aggregate arguments were never wrapped into JSON_STRING when the aggregation was a LogicalWindowAggregate, leading to a failure during planning. This change extends the rule to also cover window aggregates.
Brief change log
Verifying this change
New tests are added to verify this pr.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation