cht42 commented on code in PR #15527:
URL: https://github.com/apache/datafusion/pull/15527#discussion_r2023172721


##########
datafusion/functions-nested/src/sort.rs:
##########
@@ -207,9 +208,21 @@ pub fn array_sort_inner(args: &[ArrayRef]) -> 
Result<ArrayRef> {
             valid.append_null();
         } else {
             let arr_ref = list_array.value(i);
-            let arr_ref = arr_ref.as_ref();
 
-            let sorted_array = compute::sort(arr_ref, sort_option)?;
+            let sorted_array = match arr_ref.data_type() {
+                DataType::Struct(_) => {
+                    let sort_columns: Vec<SortColumn> = vec![SortColumn {
+                        values: Arc::clone(&arr_ref),
+                        options: sort_option,
+                    }];
+                    let indices = compute::lexsort_to_indices(&sort_columns, 
None)?;
+                    compute::take(arr_ref.as_ref(), &indices, None)?
+                }
+                _ => {
+                    let arr_ref = arr_ref.as_ref();
+                    compute::sort(arr_ref, sort_option)?

Review Comment:
   https://github.com/apache/arrow-rs/issues/6911#issuecomment-2562928843



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to