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

   ## What is the purpose of the change
   
   `StreamingJoinOperator#processElement` implements the whole regular 
streaming join in one method with deeply nested branches. Its Javadoc carries 
pseudo code that has to be kept in sync with the code by hand. The lookups of 
an input's own stored records, their guards and the changelog flags they depend 
on are spread over `AbstractStreamingJoinOperator`.
   
   This PR restructures the code. It splits the join algorithm into small 
methods, moves it into `StreamingJoinLogic`, separate from the operator's 
lifecycle and state creation, and groups the record lookups in 
`JoinInputLookups`.
   
   The results of the join, its state and its savepoints don't change. The 
first commit changes the contract of the replaced-record guard without changing 
results. The other three commits only restructure the code.
   
   ## Brief change log
   
   - **Look up the replaced record only for an input with a unique key.** 
Without a unique key, an equal record is a second record and not an update. The 
state views of such inputs already return no record without reading the state, 
so `needsReplacedRecord` now says so.
   - **Move the record lookups into `JoinInputLookups`.**
     - The lookups of an input's own stored records, their guards and the 
changelog flags they depend on move from `AbstractStreamingJoinOperator` into a 
serializable `JoinInputLookups`. These are the record an upsert replaces, and 
the full record of a DELETE that may contain only the unique key.
     - `needsReplacedRecord` and the new `needsStoredRecordOfDelete` together 
say whether the join reads the records of an input back.
     - `StreamingJoinOperator` and `StreamingSemiAntiJoinOperator` call the 
lookups directly.
   - **Split `StreamingJoinOperator#processElement` into small methods.**
     - `accumulate` and `retract` call one method per step: looking up the 
replaced or retracted record, joining the matches, gaining or losing a match of 
an outer record, and storing the record.
     - Javadoc on these methods replaces the pseudo code.
     - The order of the state accesses and of the output rows is unchanged.
   - **Extract the join logic into `StreamingJoinLogic`.**
     - The methods move unchanged, except that they call a static 
`AbstractStreamingJoinOperator#matches`.
     - `AbstractStreamingJoinOperator` gains `createRecordStateView` and 
`createJoinLogic`, so that a regular join operator creates its state views and 
its join logic the same way.
   
   ## Verifying this change
   
   This change is covered by existing tests:
   
   - **Runtime:** the join operator tests in `flink-table-runtime` 
(`org.apache.flink.table.runtime.operators.join.stream.**`) pass on every 
commit.
   - **Planner:** on the last commit, these tests pass:
     - the stream `JoinITCase` for SQL and for the Table API;
     - `JoinSemanticTests`;
     - `JoinRestoreTest`, which restores the join from savepoints.
   
   ## 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. The 
per-record path of the regular streaming join is split into smaller methods and 
goes through `StreamingJoinLogic`. It allocates nothing new per record.
   - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no. State names and 
serializers are unchanged.
   - 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 (please specify the tool below)
   
   Generated-by: Claude Code 2.1.333 (Claude Opus 5.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]

Reply via email to