beetle0915 opened a new pull request, #28987: URL: https://github.com/apache/flink/pull/28987
## What is the purpose of the change This change fixes the selection of computed grouping expressions in the Table API. Previously, a computed grouping expression such as `a > 10` was materialized as an aggregate output field, but a subsequent projection attempted to resolve the original expression against the aggregate output. Since the original field `a` was no longer available, validation failed. ## Brief change log - Assign stable output names to computed grouping expressions. - Replace matching grouping expressions in aggregate projections with references to the corresponding aggregate output fields. - Unwrap grouping expression aliases when serializing `GROUP BY`. - Add regression tests for direct reuse and structurally equivalent computed grouping expressions. - Cover both `groupBy(...).select(...)` and explicit `groupBy(...).aggregate(...).select(...)` paths while ensuring that non-grouping expressions remain rejected. ## Verifying this change This change added tests in `QueryOperationSqlSerializationTest` covering: - Selecting the same computed grouping expression. - Selecting a structurally equivalent computed grouping expression with an alias. - Selecting a computed grouping expression after an explicit `aggregate()` call. - Ensuring that a non-grouping expression is still rejected. ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no - The serializers: no - The runtime per-record code paths (performance sensitive): no - Anything that affects deployment or recovery: no - The S3 file system connector: no ## Documentation - Does this pull request introduce a new feature? no - If yes, how is the feature documented? not applicable --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes Generated-by: OpenAI Codex (GPT-5) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
