2010YOUY01 commented on code in PR #20228:
URL: https://github.com/apache/datafusion/pull/20228#discussion_r2787267388


##########
datafusion/physical-plan/src/joins/hash_join/exec.rs:
##########
@@ -1476,12 +1517,32 @@ impl ExecutionPlan for HashJoinExec {
                         filter: dynamic_filter,
                         build_accumulator: OnceLock::new(),
                     }),
+                    fetch: self.fetch,
                 });
                 result = result.with_updated_node(new_node as Arc<dyn 
ExecutionPlan>);
             }
         }
         Ok(result)
     }
+
+    fn supports_limit_pushdown(&self) -> bool {
+        // Hash join execution plan does not support pushing limit down 
through to children
+        // because the children don't know about the join condition and can't
+        // determine how many rows to produce
+        false
+    }
+
+    fn fetch(&self) -> Option<usize> {
+        self.fetch
+    }
+
+    fn with_fetch(&self, limit: Option<usize>) -> Option<Arc<dyn 
ExecutionPlan>> {
+        HashJoinExecBuilder::from(self)

Review Comment:
   I don't get the purpose of this builder, and why do we have to do a round 
trip to set this `fetch`.
   
   Also, the comment on `HashJoinExecBuilder` lacks further explanation. This 
API feels quite subtle: it resets several runtime fields (for example, the 
dynamic filter), which can be surprising. I would expect more documentation 
explaining the intended usage, invariants, and any safety considerations when 
using it.
   
   Could we do directly clone like
   ```rust
   Self {
       fetch: limit,
       // ...explicitly reset not cloneable runtime contents
       ..self.clone()
   }
   ```



##########
datafusion/physical-plan/src/joins/hash_join/exec.rs:
##########
@@ -760,6 +777,11 @@ impl HashJoinExec {
         self.null_equality
     }
 
+    /// Get the fetch (limit) for this join
+    pub fn fetch(&self) -> Option<usize> {

Review Comment:
   Is this one needed? I think we already have a equivalent one in `impl 
ExecutionPlan for HashJoinExec`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to