vegarsti commented on code in PR #17891:
URL: https://github.com/apache/datafusion/pull/17891#discussion_r2412726452


##########
datafusion/functions-aggregate-common/src/merge_arrays.rs:
##########
@@ -119,17 +119,25 @@ pub fn merge_ordered_arrays(
     // Defines according to which ordering comparisons should be done.
     sort_options: &[SortOptions],
 ) -> datafusion_common::Result<(Vec<ScalarValue>, Vec<Vec<ScalarValue>>)> {
-    // Keep track the most recent data of each branch, in binary heap data 
structure.
+    // Keep track of the most recent data of each branch, in a binary heap 
data structure.
     let mut heap = BinaryHeap::<CustomElement>::new();
 
-    if values.len() != ordering_values.len()
-        || values
-            .iter()
-            .zip(ordering_values.iter())
-            .any(|(vals, ordering_vals)| vals.len() != ordering_vals.len())
+    if values.len() != ordering_values.len() {
+        return exec_err!(
+            "Expects values and ordering_values to have same size but got {} 
and {}",
+            values.len(),
+            ordering_values.len()
+        );
+    }
+    if values
+        .iter()
+        .zip(ordering_values.iter())
+        .any(|(vals, ordering_vals)| vals.len() != ordering_vals.len())
     {
         return exec_err!(
-            "Expects values arguments and/or ordering_values arguments to have 
same size"
+            "Expects values elements and ordering_values elements to have same 
size but got {} and {}",

Review Comment:
   Yeah, good point!



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