Dandandan commented on code in PR #19602:
URL: https://github.com/apache/datafusion/pull/19602#discussion_r2658990690


##########
datafusion/physical-plan/src/joins/hash_join/partitioned_hash_eval.rs:
##########
@@ -327,12 +329,24 @@ impl PhysicalExpr for HashTableLookupExpr {
         Ok(false)
     }
 
-    fn evaluate(
-        &self,
-        batch: &arrow::record_batch::RecordBatch,
-    ) -> Result<ColumnarValue> {
+    fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue> {
         let num_rows = batch.num_rows();
 
+        // Optimization: if hash_expr is HashExpr, compute hashes directly 
into callback
+        // to avoid redundant allocations and copies.
+        if let Some(hash_expr) = 
self.hash_expr.as_any().downcast_ref::<HashExpr>() {

Review Comment:
   Isn't this always the case? We can remove the hashexpr (only store the inner 
expressions) while it is constructed to simplify the code?



-- 
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