Myracle opened a new pull request, #27533:
URL: https://github.com/apache/flink/pull/27533

   ## What is the purpose of the change
   
   This pull request adds support for `emit-only-on-update` mode in the 
CUMULATE window Table-Valued Function (TVF). When enabled, the CUMULATE window 
will skip emitting results for step intervals where no new data has arrived, 
reducing unnecessary duplicate outputs in sparse data streams. This 
optimization is particularly useful for scenarios where data arrives 
intermittently, as it avoids repeatedly outputting the same aggregation results.
   
   ## Brief change log
   
   - Added a new optional boolean parameter `emitOnlyOnUpdate` (6th parameter) 
to the `CUMULATE` window TVF SQL function
   - Extended `CumulativeWindowSpec` to support the new `emitOnlyOnUpdate` 
field with JSON serialization/deserialization
   - Modified `CumulativeSliceAssigner` in `SliceAssigners` to track and expose 
the `emitOnlyOnUpdate` configuration
   - Updated `SliceSharedSyncStateWindowAggProcessor` and 
`AsyncStateSliceSharedWindowAggProcessor` to implement the emit-only-on-update 
logic by tracking whether new data arrived in the current step interval
   - Improved `SqlWindowTableFunction.checkIntervalOperands()` to skip boolean 
parameters dynamically instead of hardcoded parameter count check
   - Added integration tests for the new feature with various scenarios 
(enabled/disabled comparison, multi-key grouping)
   - Updated documentation (both English and Chinese) with parameter 
description and usage examples
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - Added `testCumulateWindowWithEmitOnlyOnUpdate()` integration test that 
verifies windows are skipped when no new data arrives in a step interval
   - Added `testCumulateWindowWithEmitOnlyOnUpdateDisabled()` integration test 
that verifies default behavior (emitOnlyOnUpdate=false) outputs all cumulating 
windows
   - Added `testCumulateWindowWithEmitOnlyOnUpdateAndMultiKey()` integration 
test that verifies the feature works correctly with multiple grouping keys
   - Manually verified the change by comparing output row counts between 
`emitOnlyOnUpdate=true` and `emitOnlyOnUpdate=false` modes
   
   ## 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** (only added new optional field with 
backward-compatible JSON deserialization)
   - The runtime per-record code paths (performance sensitive): **yes** (added 
a boolean check in the window aggregation output path, but the overhead is 
minimal)
   - 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? **yes**
   - If yes, how is the feature documented? **docs / JavaDocs**
     - Updated `docs/content/docs/dev/table/sql/queries/window-tvf.md` (English)
     - Updated `docs/content.zh/docs/dev/table/sql/queries/window-tvf.md` 
(Chinese)
     - Added JavaDoc comments for the new parameter in 
`SqlCumulateTableFunction.java`


-- 
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]

Reply via email to