-
Notifications
You must be signed in to change notification settings - Fork 204
[AURON #1693] join operation should flush in time on duplicated keys #1701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
caa1040
d1f5e9d
7429210
059a4d6
d51385d
3c8a77a
44ab9e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -131,66 +131,37 @@ impl<const L_OUTER: bool, const R_OUTER: bool> Joiner for FullJoiner<L_OUTER, R_ | |||||||||||||||||||
| cur_forward!(cur2); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // iterate both stream, find smaller one, use it for probing | ||||||||||||||||||||
| let mut has_multi_equal = false; | ||||||||||||||||||||
| let mut l_equal = true; | ||||||||||||||||||||
| let mut r_equal = true; | ||||||||||||||||||||
| while l_equal && r_equal { | ||||||||||||||||||||
|
|
||||||||||||||||||||
| while l_equal { | ||||||||||||||||||||
| l_equal = !cur1.finished() && cur1.cur_key() == cur1.key(l_key_idx); | ||||||||||||||||||||
| if l_equal { | ||||||||||||||||||||
| l_equal = !cur1.finished() && cur1.cur_key() == cur1.key(l_key_idx); | ||||||||||||||||||||
| if l_equal { | ||||||||||||||||||||
| has_multi_equal = true; | ||||||||||||||||||||
| equal_lindices.push(cur1.cur_idx()); | ||||||||||||||||||||
| cur_forward!(cur1); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| equal_lindices.push(cur1.cur_idx()); | ||||||||||||||||||||
| cur_forward!(cur1); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| while r_equal { | ||||||||||||||||||||
| r_equal = !cur2.finished() && cur2.cur_key() == cur2.key(r_key_idx); | ||||||||||||||||||||
| if r_equal { | ||||||||||||||||||||
| r_equal = !cur2.finished() && cur2.cur_key() == cur2.key(r_key_idx); | ||||||||||||||||||||
| if r_equal { | ||||||||||||||||||||
| has_multi_equal = true; | ||||||||||||||||||||
| equal_rindices.push(cur2.cur_idx()); | ||||||||||||||||||||
| cur_forward!(cur2); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| equal_rindices.push(cur2.cur_idx()); | ||||||||||||||||||||
| cur_forward!(cur2); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // fast path for one-to-one join | ||||||||||||||||||||
| if !has_multi_equal { | ||||||||||||||||||||
| if equal_lindices.len() <= 1 && equal_rindices.len() <= 1 { | ||||||||||||||||||||
| self.lindices.push(l_key_idx); | ||||||||||||||||||||
| self.rindices.push(r_key_idx); | ||||||||||||||||||||
| continue; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| for (&lidx, &ridx) in equal_lindices.iter().cartesian_product(&equal_rindices) { | ||||||||||||||||||||
| self.lindices.push(lidx); | ||||||||||||||||||||
| self.rindices.push(ridx); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if r_equal { | ||||||||||||||||||||
| // stream right side | ||||||||||||||||||||
| while !cur2.finished() && cur2.cur_key() == cur1.key(l_key_idx) { | ||||||||||||||||||||
| for &lidx in &equal_lindices { | ||||||||||||||||||||
| self.lindices.push(lidx); | ||||||||||||||||||||
| self.rindices.push(cur2.cur_idx()); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| cur_forward!(cur2); | ||||||||||||||||||||
| if self.should_flush() || cur2.num_buffered_batches() > 1 { | ||||||||||||||||||||
| self.as_mut().flush(cur1, cur2).await?; | ||||||||||||||||||||
| cur2.clean_out_dated_batches(); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if l_equal { | ||||||||||||||||||||
| // stream left side | ||||||||||||||||||||
| while !cur1.finished() && cur1.cur_key() == cur2.key(r_key_idx) { | ||||||||||||||||||||
| for &ridx in &equal_rindices { | ||||||||||||||||||||
| self.lindices.push(cur1.cur_idx()); | ||||||||||||||||||||
| self.rindices.push(ridx); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| cur_forward!(cur1); | ||||||||||||||||||||
| if self.should_flush() || cur1.num_buffered_batches() > 1 { | ||||||||||||||||||||
| for &lidx in &equal_lindices { | ||||||||||||||||||||
| for &ridx in &equal_rindices { | ||||||||||||||||||||
| self.lindices.push(lidx); | ||||||||||||||||||||
| self.rindices.push(ridx); | ||||||||||||||||||||
| if self.should_flush() { | ||||||||||||||||||||
| self.as_mut().flush(cur1, cur2).await?; | ||||||||||||||||||||
|
||||||||||||||||||||
| if self.should_flush() { | |
| self.as_mut().flush(cur1, cur2).await?; | |
| if self.should_flush() | |
| || cur1.num_buffered_batches() > 1 | |
| || cur2.num_buffered_batches() > 1 | |
| { | |
| self.as_mut().flush(cur1, cur2).await?; | |
| cur1.clean_out_dated_batches(); | |
| cur2.clean_out_dated_batches(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not call cur1 .clean_out_dated_batches(), because doing so will break the index correlation between cur1 and equal_lindices.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
And don't forget to clear the outdated batches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added this logic and unit test. But we should not clear the outdated batches here.