jayzhan211 commented on code in PR #7862:
URL: https://github.com/apache/arrow-datafusion/pull/7862#discussion_r1369344751


##########
datafusion/common/src/scalar.rs:
##########
@@ -2156,30 +2157,58 @@ impl ScalarValue {
     ///
     /// assert_eq!(scalar_vec, expected);
     /// ```
-    pub fn convert_array_to_scalar_vec(array: &dyn Array) -> 
Result<Vec<Vec<Self>>> {
-        let mut scalars = Vec::with_capacity(array.len());
+    pub fn convert_list_array_to_scalar_vec(array: &dyn Array) -> 
Result<Vec<Vec<Self>>> {
+        let mut scalars_vec = Vec::with_capacity(array.len());
+
+        if as_list_array(array).is_ok() {

Review Comment:
   I think it would be nice to change both functions to ensure only ListArray 
is accepted in `convert_list_array_to_scalar_vec ` and non-ListArray is 
accepted in `convert_non_list_array_to_scalar_vec `.



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