-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: nested loop join requires outer table to be a FusedStream #12189
Conversation
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.
Is this bug visible/reproducible somehow? If so, could you add a regression test?
@crepererum This bug is triggered by our customized It is simple to mimic the above situation. Firstly, modify the MemoryStream such that it does not support fn poll_next(
mut self: std::pin::Pin<&mut Self>,
_: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
Poll::Ready(if self.index < self.data.len() {
self.index += 1;
let batch = &self.data[self.index - 1];
// return just the columns requested
let batch = match self.projection.as_ref() {
Some(columns) => batch.project(columns)?,
None => batch.clone(),
};
Some(Ok(batch))
} else if self.index == self.data.len() {
self.index += 1;
None
} else {
panic!("Exhausted stream is polled again")
})
} Secondly, run the CREATE TABLE wtf AS VALUES (4, 'arrow'), (99, 'datafusion');
select t0.column1, t1.column1, t0.column2, t1.column2 from wtf t0 left join wtf t1 on t0.column1 > t1.column1; Then, we will hit the Currently, the |
I think we have roughly the following paths forward here:
|
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.
Thank you @crepererum and @YjyJeff -- I think this PR would be ok to merge.
just fix this issue here (w/ or w/o regression test)
I would prefer "fix the issue here with a regression test"
The reason I suggest a regression test is that otherwise this code may very well get lost in a future refactoring -- without regression tests for coverage we wouldn't know if this happened
Do you think you can add such a test @YjyJeff ?
I will wait a few more days to merge this PR to see if @YjyJeff can help add a regression test |
Merging this to get it into 42 It would be great to get a test for this @YjyJeff otherwise it is likely a regression will creep in. Let's try and do that as a follow on PR |
Which issue does this PR close?
Closes #12187
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Yes
Are there any user-facing changes?
No