This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/main/pr-24040-b4cde12a85b1201cb6addd8d328d30f4c5691507
in repository https://gitbox.apache.org/repos/asf/datafusion.git

commit b9022565e294072d7bca039f743b1cacdf10dee1
Author: Saad Tajwar <[email protected]>
AuthorDate: Sat Aug 1 10:05:09 2026 -0400

    fix: rows_to_array cleanup for expecting single field (#24040)
    
    ## Which issue does this PR close?
    
    - Closes #23996
    
    ## Rationale for this change
    
    Making the `rows_to_array` method in`RowsGroupColumn` behavior of
    expecting a singular field explicit, as before it used a generic vector
    operation of `swap_remove(0)` and a `debug_assert_eq!` for ensuring that
    there was only a single field extracted
    
    ## What changes are included in this PR?
    
    Changed the `debug_assert_eq!` to the non-debug macro with a clear error
    message & changing the `swap_remove(0)` to a `pop` with `unwrap` now
    that we are guaranteeing the invariant
    
    ## Are these changes tested?
    
    Yes
    
    ## Are there any user-facing changes?
    
    No
---
 .../src/aggregates/group_values/multi_group_by/row_backed.rs     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/row_backed.rs
 
b/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/row_backed.rs
index 29beb3bd66..31735559cd 100644
--- 
a/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/row_backed.rs
+++ 
b/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/row_backed.rs
@@ -213,8 +213,13 @@ impl RowsGroupColumn {
             .row_converter
             .convert_rows(rows)
             .expect("row conversion during emit");
-        debug_assert_eq!(arrays.len(), 1, "single-field row converter");
-        let array = arrays.swap_remove(0);
+        assert_eq!(
+            arrays.len(),
+            1,
+            "Single field row converter must produce exactly one array, actual 
length is {}",
+            arrays.len()
+        );
+        let array = arrays.pop().unwrap();
         encode_array_if_necessary(&array, &self.output_type)
             .expect("dictionary re-encode during emit")
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to