crepererum commented on code in PR #6225:
URL: https://github.com/apache/arrow-rs/pull/6225#discussion_r1713611463
##########
arrow-ord/src/sort.rs:
##########
@@ -4203,4 +4237,43 @@ mod tests {
let sort_indices = sort_to_indices(&a, None, None).unwrap();
assert_eq!(sort_indices.values(), &[1, 2, 0]);
}
+
+ #[test]
+ fn sort_struct_fallback_to_lexsort() {
+ let float = Arc::new(Float32Array::from(vec![1.0, -0.1, 3.5, 1.0]));
+ let int = Arc::new(Int32Array::from(vec![42, 28, 19, 31]));
+
+ let struct_array = StructArray::from(vec![
+ (
+ Arc::new(Field::new("b", DataType::Float32, false)),
+ float.clone() as ArrayRef,
+ ),
+ (
+ Arc::new(Field::new("c", DataType::Int32, false)),
+ int.clone() as ArrayRef,
+ ),
+ ]);
+
+ assert!(!can_sort_to_indices(struct_array.data_type()));
+ assert!(sort_to_indices(&struct_array, None, None).is_err());
Review Comment:
might be helpful to check the error, either via `matches!`/`assert_matches!`
or via `err.to_string()` so we make sure that the right error is returned on
not some abstract "internal error" or something.
--
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]