jayzhan211 commented on code in PR #7629:
URL: https://github.com/apache/arrow-datafusion/pull/7629#discussion_r1353797274
##########
datafusion/common/src/scalar.rs:
##########
@@ -2093,18 +2203,29 @@ impl ScalarValue {
DataType::Utf8 => typed_cast!(array, index, StringArray, Utf8),
DataType::LargeUtf8 => typed_cast!(array, index, LargeStringArray,
LargeUtf8),
DataType::List(nested_type) => {
- let list_array = as_list_array(array)?;
- let value = match list_array.is_null(index) {
- true => None,
+ let list_array = as_list_array(array);
+ let arr = match list_array.is_null(index) {
+ true => new_null_array(nested_type.data_type(), 0),
false => {
let nested_array = list_array.value(index);
- let scalar_vec = (0..nested_array.len())
- .map(|i|
ScalarValue::try_from_array(&nested_array, i))
- .collect::<Result<Vec<_>>>()?;
- Some(scalar_vec)
+ Arc::new(wrap_into_list_array(nested_array))
}
};
- ScalarValue::new_list(value, nested_type.data_type().clone())
+
+ ScalarValue::List(arr)
+ }
+ // TODO: There is no test for FixedSizeList now, add it later
Review Comment:
No, I think this should be fixed in another PR
--
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]