Jefffrey commented on code in PR #18981:
URL: https://github.com/apache/datafusion/pull/18981#discussion_r2571256468


##########
datafusion/common/src/hash_utils.rs:
##########
@@ -535,6 +580,23 @@ fn hash_single_array(
             let array = as_union_array(array)?;
             hash_union_array(array, random_state, hashes_buffer)?;
         }
+        DataType::RunEndEncoded(run_ends_type, _) => {
+            match run_ends_type.data_type() {
+                DataType::Int16 => {
+                    let array = as_run_array::<Int16Type>(array)?;
+                    hash_run_array(array, random_state, hashes_buffer, 
rehash)?;
+                }
+                DataType::Int32 => {
+                    let array = as_run_array::<Int32Type>(array)?;
+                    hash_run_array(array, random_state, hashes_buffer, 
rehash)?;
+                }
+                DataType::Int64 => {
+                    let array = as_run_array::<Int64Type>(array)?;
+                    hash_run_array(array, random_state, hashes_buffer, 
rehash)?;
+                }
+                _ => unreachable!("RunEndEncoded must have Int16, Int32, or 
Int64 run ends")
+            }
+        }

Review Comment:
   Perhaps can use 
[`downcast_run_array`](https://docs.rs/datafusion/latest/datafusion/common/arrow/array/macro.downcast_run_array.html)
 similar to dictionary above



##########
datafusion/common/src/hash_utils.rs:
##########
@@ -484,6 +485,50 @@ fn hash_fixed_list_array(
     Ok(())
 }
 
+#[cfg(not(feature = "force_hash_collisions"))]
+fn hash_run_array<R: RunEndIndexType>(
+    array: &RunArray<R>,
+    random_state: &RandomState,
+    hashes_buffer: &mut [u64],
+    rehash: bool,
+) -> Result<()> {
+    // Get the physical values and create a clone for hashing
+    let values = array.values();
+    let values_len = values.len();
+    let mut values_hashes = vec![0u64; values_len];
+    create_hashes(&[Arc::clone(values)], random_state, &mut values_hashes)?;
+
+    // Get run ends buffer

Review Comment:
   Could we remove these verbose, LLM-like comments throughout the PR



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