alamb commented on code in PR #15302:
URL: https://github.com/apache/datafusion/pull/15302#discussion_r2004105137


##########
datafusion/physical-plan/src/sorts/sort.rs:
##########
@@ -278,12 +280,29 @@ impl ExternalSorter {
             MemoryConsumer::new(format!("ExternalSorterMerge[{partition_id}]"))
                 .register(&runtime.memory_pool);
 
+        // Construct RowConverter for sort keys
+        let sort_fields = expr
+            .iter()
+            .map(|e| {
+                let data_type = e
+                    .expr
+                    .data_type(&schema)
+                    .map_err(|e| e.context("Resolving sort expression data 
type"))?;
+                Ok(SortField::new_with_options(data_type, e.options))
+            })
+            .collect::<Result<Vec<_>>>()
+            .expect("Valid sort fields");
+
+        let converter = RowConverter::new(sort_fields)

Review Comment:
   it is probably good to return a runtime error here rather than panic'ing 
(for example if someone tried to sort an REE array or UnionArray it might panic)



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