compute: simplify mz_join_core result computation#19667
Merged
teskje merged 1 commit intoMaterializeInc:mainfrom Jun 14, 2023
Merged
compute: simplify mz_join_core result computation#19667teskje merged 1 commit intoMaterializeInc:mainfrom
teskje merged 1 commit intoMaterializeInc:mainfrom
Conversation
vmarcos
approved these changes
Jun 5, 2023
Contributor
vmarcos
left a comment
There was a problem hiding this comment.
Agreed from my side, thanks!
Contributor
Author
|
On request from @antiguru I opened a backport PR for DD as well: TimelyDataflow/differential-dataflow#392 |
Previously, the mz_join_core code wrapped the `result` closure into another `work_result` closure, to deal with the fact that matches from the `todo1` list had their value and diff fields swapped. Instead of having a closure to unswap the fields, we can simply pass them to the `Deferred` constructor in the correct order instead. That is, the `Deferred` constructor should always receive the cursor/storage from input 1 first and from input 2 second. If we make this change, no `work_result` closure is necessary and the code become easier to reason about.
870de8c to
8b6451b
Compare
antiguru
approved these changes
Jun 12, 2023
Member
antiguru
left a comment
There was a problem hiding this comment.
Thanks, I think this mostly looks good. One thing I'm not 100% sure about is renaming trace/batch to cursor 1/2. Can you confirm that they're used symmetrically, i.e., we could swap the arguments and produce the same result?
Contributor
Author
|
Here are the things that changes for new batches received from input 1 (nothing changes for batches from input 2):
|
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.
Previously, the
mz_join_corecode wrapped theresultclosure into anotherwork_resultclosure, to deal with the fact that matches from thetodo1list had their value and diff fields swapped.Instead of having a closure to unswap the fields, we can simply pass them to the
Deferredconstructor in the correct order instead. That is, theDeferredconstructor should always receive the cursor/storage from input 1 first and from input 2 second. If we make this change, nowork_resultclosure is necessary and the code become easier to reason about.Motivation
This is something I stumbled over while working on support for a fueled merge join strategy.
Tips for reviewer
Part of this PR is renaming the fields of
Deferredto reflect that (first, second) shouldn't be (trace, batch) but (input 1, input 2). The rest of the PR removes thework_resultwrapper closure by inlining its logic intoDeferred::work.Checklist
$T ⇔ Proto$Tmapping (possibly in a backwards-incompatible way), then it is tagged with aT-protolabel.