friendlymatthew commented on code in PR #8838:
URL: https://github.com/apache/arrow-rs/pull/8838#discussion_r2543351869
##########
arrow-ord/src/ord.rs:
##########
@@ -296,6 +296,70 @@ fn compare_struct(
Ok(f)
}
+fn compare_union(
+ left: &dyn Array,
+ right: &dyn Array,
+ opts: SortOptions,
+) -> Result<DynComparator, ArrowError> {
+ let left = left.as_union();
+ let right = right.as_union();
+
+ let (left_fields, left_mode) = match left.data_type() {
+ DataType::Union(fields, mode) => (fields, mode),
+ _ => unreachable!(),
+ };
+ let (right_fields, right_mode) = match right.data_type() {
+ DataType::Union(fields, mode) => (fields, mode),
+ _ => unreachable!(),
+ };
+
+ if left_fields != right_fields || left_mode != right_mode {
+ return Err(ArrowError::InvalidArgumentError(
+ "Cannot compare UnionArrays with different fields or
modes".to_string(),
Review Comment:
See
[c91aec7](https://github.com/apache/arrow-rs/pull/8838/commits/c91aec7f1671415457e9bcc629ac98709e8e14ab)
##########
arrow-ord/src/ord.rs:
##########
@@ -296,6 +296,70 @@ fn compare_struct(
Ok(f)
}
+fn compare_union(
+ left: &dyn Array,
+ right: &dyn Array,
+ opts: SortOptions,
+) -> Result<DynComparator, ArrowError> {
+ let left = left.as_union();
+ let right = right.as_union();
+
+ let (left_fields, left_mode) = match left.data_type() {
+ DataType::Union(fields, mode) => (fields, mode),
+ _ => unreachable!(),
+ };
+ let (right_fields, right_mode) = match right.data_type() {
+ DataType::Union(fields, mode) => (fields, mode),
+ _ => unreachable!(),
+ };
+
+ if left_fields != right_fields || left_mode != right_mode {
+ return Err(ArrowError::InvalidArgumentError(
+ "Cannot compare UnionArrays with different fields or
modes".to_string(),
Review Comment:
please see
[c91aec7](https://github.com/apache/arrow-rs/pull/8838/commits/c91aec7f1671415457e9bcc629ac98709e8e14ab)
--
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]