rluvaton commented on code in PR #19520:
URL: https://github.com/apache/datafusion/pull/19520#discussion_r2649657319


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs:
##########
@@ -491,74 +528,168 @@ impl<const STREAMING: bool> GroupValuesColumn<STREAMING> 
{
         batch_hashes: &[u64],
         groups: &mut [usize],
     ) {
+        // ➜  ~ sysctl hw.l1dcachesize
+        // L1 cache size: 65536
+        // L2 cache size: 4194304
+
+        let should_prefetch = if self.agg_prefetch_locality == 1 {
+            self.agg_prefetch_elements > 0 && self.map_size >= l1_cache_size()
+        } else if self.agg_prefetch_locality == 2 {
+            self.agg_prefetch_elements > 0 && self.map_size >= l2_cache_size()
+        }  else if self.agg_prefetch_locality == 3 {
+            self.agg_prefetch_elements > 0 && self.map_size >= l3_cache_size()
+        } else {
+            self.agg_prefetch_elements > 0
+        };
+
+        if !should_prefetch {
+            
self.collect_vectorized_process_context_with_prefetch::<0>(batch_hashes, 
groups);
+            return;
+        }
+
+        match self.agg_prefetch_elements {
+            0 => 
self.collect_vectorized_process_context_with_prefetch::<0>(batch_hashes, 
groups),
+            1 => 
self.collect_vectorized_process_context_with_prefetch::<1>(batch_hashes, 
groups),
+            2 => 
self.collect_vectorized_process_context_with_prefetch::<2>(batch_hashes, 
groups),
+            3 => 
self.collect_vectorized_process_context_with_prefetch::<3>(batch_hashes, 
groups),
+            4 => 
self.collect_vectorized_process_context_with_prefetch::<4>(batch_hashes, 
groups),
+            5 => 
self.collect_vectorized_process_context_with_prefetch::<5>(batch_hashes, 
groups),
+            6 => 
self.collect_vectorized_process_context_with_prefetch::<6>(batch_hashes, 
groups),
+            7 => 
self.collect_vectorized_process_context_with_prefetch::<7>(batch_hashes, 
groups),
+            8 => 
self.collect_vectorized_process_context_with_prefetch::<8>(batch_hashes, 
groups),
+            _ => 
self.collect_vectorized_process_context_with_prefetch::<8>(batch_hashes, 
groups),
+        }
+    }

Review Comment:
   Added all of these to make sure when I test specific config I'm not affected 
by the condition, will not have this later



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