rkrishn7 commented on code in PR #27499:
URL: https://github.com/apache/datafusion/pull/27499#discussion_r4596052229


##########
datafusion/physical-plan/src/aggregates/group_values/single_group_by/primitive.rs:
##########
@@ -161,6 +161,28 @@ where
         Ok(())
     }
 
+    fn find(&mut self, cols: &[ArrayRef], groups: &mut Vec<Option<usize>>) -> 
Result<()> {
+        assert_eq!(cols.len(), 1);
+        groups.clear();
+
+        for v in cols[0].as_primitive::<T>() {
+            let group_id = match v {
+                None => self.null_group,
+                Some(key) => {
+                    let key = key.normalize_key();
+                    let hash = key.hash(&self.random_state);
+                    self.map
+                        .find(hash, |&(g, h)| unsafe {

Review Comment:
   Updated both here and `intern` in 
[905cecd](https://github.com/apache/datafusion/pull/27499/commits/905cecd9f54b3a0b422f9e91c2e8c96728b1b2bc)



##########
datafusion/physical-plan/src/aggregates/group_values/row.rs:
##########
@@ -177,6 +177,40 @@ impl GroupValues for GroupValuesRows {
         Ok(())
     }
 
+    fn find(&mut self, cols: &[ArrayRef], groups: &mut Vec<Option<usize>>) -> 
Result<()> {
+        // Same normalization as `intern`, so lookups agree with stored keys.
+        let normalized_cols: Vec<ArrayRef> = cols
+            .iter()
+            .map(|col| float_semantics::normalize(Arc::clone(col)))
+            .collect();
+        let cols = normalized_cols.as_slice();
+
+        let group_rows = &mut self.rows_buffer;
+        group_rows.clear();
+        self.row_converter.append(group_rows, cols)?;
+        let n_rows = group_rows.num_rows();
+
+        let batch_hashes = &mut self.hashes_buffer;
+        batch_hashes.clear();
+        batch_hashes.resize(n_rows, 0);
+        create_hashes(cols, &self.random_state, batch_hashes)?;
+
+        groups.clear();
+        let Some(group_values) = self.group_values.as_ref() else {

Review Comment:
   Done in 
[905cecd](https://github.com/apache/datafusion/pull/27499/commits/905cecd9f54b3a0b422f9e91c2e8c96728b1b2bc)



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