Skip to content

[FLINK-40271][table] Fix SQL serialization of Table API group window properties - #28886

Open
Timm0 wants to merge 1 commit into
apache:masterfrom
Timm0:FLINK-40271
Open

[FLINK-40271][table] Fix SQL serialization of Table API group window properties#28886
Timm0 wants to merge 1 commit into
apache:masterfrom
Timm0:FLINK-40271

Conversation

@Timm0

@Timm0 Timm0 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

Table API group-window properties — $("w").start(), $("w").end(), $("w").rowtime() and $("w").proctime() — were not translated to the corresponding windowing-TVF output columns when a WindowAggregateQueryOperation is serialized back to SQL. The group window alias was emitted as if it were a column reference, so the generated statement failed to validate with Column 'w' not found in any table. This change maps each property onto the TVF's window_start / window_end / window_time columns and adds window_time to the GROUP BY when it is projected, so the serialized SQL parses and produces the same results as the Table API program it came from.

Brief change log

  • Serialize window properties to the windowing-TVF output columns window_start, window_end and window_time instead of emitting the group window alias, which produced unparseable SQL
  • Add window_time to the GROUP BY when a rowtime()/proctime() property is projected
  • Reject a proctime() property on an event-time group window with a TableException
  • Add TableTestProgram#getRunTableApiTestStep
  • Add rowtime and proctime serialization test programs, plus semantic coverage of the generated SQL for the rowtime case

Verifying this change

  • New tests in QueryOperationSqlSerializationTest and QueryOperationSqlSemanticTest

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: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? n/a

Was generative AI tooling used to co-author this PR?
  • Yes

Generated-by: Claude Code Opus 5 (1M context)

- Serialize window properties to the windowing-TVF output columns `window_start`, `window_end` and `window_time` instead of emitting the group window alias, which produced unparseable SQL
- Add `window_time` to the `GROUP BY` when a `rowtime()`/`proctime()` property is projected
- Reject a `proctime()` property on an event-time group window with a `TableException`
- Add `TableTestProgram#getRunTableApiTestStep`
- Add rowtime and proctime serialization test programs, plus semantic coverage of the generated SQL for the rowtime case
@Timm0
Timm0 marked this pull request as ready for review August 3, 2026 09:55
@flinkbot

flinkbot commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants