1fanwang opened a new pull request, #29961: URL: https://github.com/apache/flink/pull/29961
**(The sections below can be removed for hotfixes of typos)** ## What is the purpose of the change One-phase batch sliding group windows can place a row according to an aggregate buffer value instead of its timestamp when pane pre-aggregation is enabled. The query returns incorrect window boundaries. This fixes [FLINK-41506](https://issues.apache.org/jira/browse/FLINK-41506). ## Brief change log - Use the assigned pane timestamp when grouping pre-accumulated rows. - Test one-phase sliding windows with and without a grouping key. ## Verifying this change Please make sure both new and modified tests in this PR follow [the conventions for tests defined in our code quality guide](https://flink.apache.org/how-to-contribute/code-style-and-quality-common/#7-testing). This change added tests and can be verified as follows: The no-key SUM/HOP query passes with the original code because its optimized input is ordered as rt, v. The keyed query has rt at index 2 and one grouping key, and reproduces the incorrect windows below. ```shell JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home ./mvnw -pl flink-table/flink-table-planner -Dtest=GroupWindowITCase#testSlidingWindowOnePhaseWithTimeAttributeAfterAggregateInput -Dfast test ``` Pre-fix result from the keyed query: ```text Results == Correct Result - 4 == == Actual Result - 4 == !+I[1, 7000, 2001-09-09T01:46:30] +I[1, 7000, 1969-12-31T23:59:57] !+I[1, 7000, 2001-09-09T01:46:33] +I[1, 7000, 1970-01-01T00:00:03] !+I[1, 7000, 2001-09-09T01:46:36] +I[1, 7000, 1970-01-01T00:00:06] !+I[1, 7000, 2001-09-09T01:46:39] +I[1, 7000, 1970-01-01T00:00] ``` The same keyed SQL path after the fix produced: ```text POST_FIX_KEYED_RESULT=Buffer(+I[1, 7000, 2001-09-09T01:46:30], +I[1, 7000, 2001-09-09T01:46:33], +I[1, 7000, 2001-09-09T01:46:36], +I[1, 7000, 2001-09-09T01:46:39]) ``` The keyed and no-key assertions use the same test. The no-key assertion covers the no-key generation path; the keyed query is the reproducer. ## 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): yes - 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? not applicable --- ##### Was generative AI tooling used to co-author this PR? <!-- If a generative tool has been used in the process of authoring this PR, please change the checkbox below to `[X]` and replace the placeholder in the attribution line with the tool name and version. Otherwise remove the attribution line. See the ASF Generative Tooling Guidance for details: https://www.apache.org/legal/generative-tooling.html You are responsible for the quality and correctness of every change in this PR regardless of the tooling used. Low-effort AI-generated PRs will be closed. See AGENTS.md for the full guidance. --> - [X] Yes Generated-by: GitHub Copilot CLI 1.0.102-0.unstable.r40949665530.gab1eef5 (Auto) -- 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]
