rspears74 commented on code in PR #8562:
URL: https://github.com/apache/arrow-datafusion/pull/8562#discussion_r1443528261


##########
datafusion/common/src/scalar.rs:
##########
@@ -359,29 +359,77 @@ impl PartialOrd for ScalarValue {
             (FixedSizeBinary(_, _), _) => None,
             (LargeBinary(v1), LargeBinary(v2)) => v1.partial_cmp(v2),
             (LargeBinary(_), _) => None,
-            (List(arr1), List(arr2))
-            | (FixedSizeList(arr1), FixedSizeList(arr2))
-            | (LargeList(arr1), LargeList(arr2)) => {
-                // ScalarValue::List / ScalarValue::FixedSizeList / 
ScalarValue::LargeList are ensure to have length 1
+            // ScalarValue::List / ScalarValue::FixedSizeList / 
ScalarValue::LargeList are ensure to have length 1
+            (List(arr1), List(arr2)) => {
                 assert_eq!(arr1.len(), 1);
                 assert_eq!(arr2.len(), 1);
 
                 if arr1.data_type() != arr2.data_type() {
                     return None;
                 }
 
-                fn first_array_for_list(arr: &ArrayRef) -> ArrayRef {
-                    if let Some(arr) = arr.as_list_opt::<i32>() {
-                        arr.value(0)
-                    } else if let Some(arr) = arr.as_list_opt::<i64>() {
-                        arr.value(0)
-                    } else if let Some(arr) = arr.as_fixed_size_list_opt() {
-                        arr.value(0)
-                    } else {
-                        unreachable!("Since only List / LargeList / 
FixedSizeList are supported, this should never happen")
+                fn first_array_for_list(arr: &Arc<ListArray>) -> ArrayRef {

Review Comment:
   This one is a little tougher, because if the args to the function are 
"generic" (i.e. ArrayRef instead of a specific `Arc<ListArray>` type), the 
`arr1.value(0)` method is not available. The `first_array_for_list` function 
needs to be able to convert the `ArrayRef` into the specific type to then get 
the value out. So I'm struggling a bit coming up with a way here.



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

Reply via email to