This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new b25aa33ef8 fix: nested loop join requires outer table to be a
FusedStream (#12189)
b25aa33ef8 is described below
commit b25aa33ef8465a756a021c6948b3a16aef7ce6ca
Author: YjyJeff <[email protected]>
AuthorDate: Fri Sep 13 00:08:02 2024 +0800
fix: nested loop join requires outer table to be a FusedStream (#12189)
Co-authored-by: jefffffyang <[email protected]>
---
datafusion/physical-plan/src/joins/nested_loop_join.rs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/datafusion/physical-plan/src/joins/nested_loop_join.rs
b/datafusion/physical-plan/src/joins/nested_loop_join.rs
index dadd20714e..c6f1833c13 100644
--- a/datafusion/physical-plan/src/joins/nested_loop_join.rs
+++ b/datafusion/physical-plan/src/joins/nested_loop_join.rs
@@ -316,6 +316,7 @@ impl ExecutionPlan for NestedLoopJoinExec {
self.right().output_partitioning().partition_count(),
)
});
+
let outer_table = self.right.execute(partition, context)?;
Ok(Box::pin(NestedLoopJoinStream {
@@ -471,6 +472,12 @@ impl NestedLoopJoinStream {
// Get or initialize visited_left_side bitmap if required by join type
let visited_left_side = left_data.bitmap();
+ // Check is_exhausted before polling the outer_table, such that when
the outer table
+ // does not support `FusedStream`, Self will not poll it again
+ if self.is_exhausted {
+ return Poll::Ready(None);
+ }
+
self.outer_table
.poll_next_unpin(cx)
.map(|maybe_batch| match maybe_batch {
@@ -501,8 +508,7 @@ impl NestedLoopJoinStream {
}
Some(err) => Some(err),
None => {
- if need_produce_result_in_final(self.join_type) &&
!self.is_exhausted
- {
+ if need_produce_result_in_final(self.join_type) {
// At this stage `visited_left_side` won't be updated,
so it's
// safe to report about probe completion.
//
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]