You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/24 20:29:03 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3187: Support StructArray in DynComparator

tustvold commented on code in PR #3187:
URL: https://github.com/apache/arrow-rs/pull/3187#discussion_r1031807817


##########
arrow/src/array/ord.rs:
##########
@@ -303,6 +303,26 @@ pub fn build_compare(left: &dyn Array, right: &dyn Array) -> Result<DynComparato
 
             Box::new(move |i, j| left.value(i).cmp(right.value(j)))
         }
+        (Struct(f), Struct(_)) => {
+            let left = as_struct_array(left);
+            let right = as_struct_array(right);
+
+            let comparators = (0..f.len())
+                .map(|idx| {
+                    build_compare(left.column(idx).as_ref(), right.column(idx).as_ref())
+                })
+                .collect::<Result<Vec<_>>>()?;
+
+            Box::new(move |i, j| {
+                for c in &comparators {
+                    match c(i, j) {

Review Comment:
   The performance will not be spectacular, but as mentioned on #3185 performant comparisons should be performed using the row format - this is mainly for completeness



-- 
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-unsubscribe@arrow.apache.org

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