[FLINK-40336][table] Add TemporalRowTimeJoinOperatorV2 to improve join on sorted state backends - #28929
Open
mateczagany wants to merge 1 commit into
Open
[FLINK-40336][table] Add TemporalRowTimeJoinOperatorV2 to improve join on sorted state backends#28929mateczagany wants to merge 1 commit into
mateczagany wants to merge 1 commit into
Conversation
…n on sorted state backends
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
On every watermark,
emitResultAndCleanUpStatewill scan the fullleftStateof every key, which includes a full deserialization, including all the elements which have have higher timestamps than the current watermark. This work is completely unneeded, and for some specific Flink jobs, the speedup this new operator brings can be very much noticable.With RocksDB and ForSt, when iterating the state, the keys returned will always be ordered in a serialized-key byte order, so it's easy to take an advantage of that, and exit early from the iteration of the state.
Brief change log
TemporalRowTimeJoinOperatorV2(flink-table-runtime):LeftTimeIndexKeygetBackendTypeIdentifier(), same idiom asInputSortBuffer/LateralSnapshotJoinOperator), both states are iterated in ascending time order with early exit at the watermark@ExecNodeMetadata(version = 2)toStreamExecTemporalJoin.createJoinOperatorpicks the operator bygetVersion(). Version 1 plans keep instantiatingTemporalRowTimeJoinOperatorstream-exec-temporal-join_2for all four temporal join test programs.LeftTimeIndexKeySerializerinTypeSerializerTestCoverageTest.Verifying this change
TemporalRowTimeJoinOperatorV2Test: all scenarios ofTemporalRowTimeJoinOperatorTestmirrored with identical inputs/expected outputsLeftTimeIndexKeySerializerTest:SerializerTestBasebattery plus a property test asserting unsigned lexicographic byte order equals numeric(timestamp, index)order.TemporalJoinRestoreTest: version 1 savepoints restore into the old operator, version 2 savepoints into the new one (both on RocksDB)TemporalJoinITCasepasses unmodified; fresh plans now compile tostream-exec-temporal-join_2and run the new operator end-to-end.TemporalRowTimeJoinOperatorTestis untouched and still passesDoes this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: [Tool Name and Version]