You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/05/01 13:42:21 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6170: Simplify HashJoin memory accounting

alamb commented on code in PR #6170:
URL: https://github.com/apache/arrow-datafusion/pull/6170#discussion_r1181579394


##########
datafusion/core/src/physical_plan/joins/hash_join.rs:
##########
@@ -362,45 +355,35 @@ impl ExecutionPlan for HashJoinExec {
         }
 
         let join_metrics = BuildProbeJoinMetrics::new(partition, &self.metrics);
-
-        // Initialization of operator-level reservation
-        self.reservation
-            .initialize("HashJoinExec", context.memory_pool());
-
-        // Inititalization of stream-level reservation
-        let reservation = SharedMemoryReservation::from(
-            MemoryConsumer::new(format!("HashJoinStream[{partition}]"))
-                .register(context.memory_pool()),
-        );
-
-        // Memory reservation for left-side data depends on PartitionMode:
-        // - operator-level for `CollectLeft` mode
-        // - stream-level for partitioned mode
-        //
-        // This approach allows to avoid cases when left data could potentially
-        // outlive its memory reservation and rely on `MemoryReservation` destructors
-        // for releasing memory in pool.
         let left_fut = match self.mode {
             PartitionMode::CollectLeft => self.left_fut.once(|| {
+                let reservation =

Review Comment:
   I wonder if the same simplification can be applied to Nested Loops Joins and Symmetric Hash Join 🤔 
   
   https://github.com/search?q=repo%3Aapache%2Farrow-datafusion%20SharedMemoryReservation&type=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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org