grorge123 commented on code in PR #7381:
URL: https://github.com/apache/datafusion-comet/pull/7381#discussion_r4442237465
##########
native/spark-expr/src/struct_funcs/get_struct_field.rs:
##########
@@ -123,6 +125,20 @@ impl PhysicalExpr for GetStructField {
}
}
+/// The scalar that a one-row array holds. A list wraps the array as is:
`try_from_array` rebuilds
+/// a list's element field from its name and nullability, which drops metadata
such as a Variant
+/// element's extension type, so the scalar's type would no longer match
`data_type`.
+fn single_row_scalar(array: ArrayRef) -> DataFusionResult<ScalarValue> {
+ Ok(match array.data_type() {
+ DataType::List(_) =>
ScalarValue::List(Arc::new(array.as_list::<i32>().clone())),
+ DataType::LargeList(_) =>
ScalarValue::LargeList(Arc::new(array.as_list::<i64>().clone())),
+ DataType::FixedSizeList(_, _) => {
+
ScalarValue::FixedSizeList(Arc::new(array.as_fixed_size_list().clone()))
+ }
+ _ => ScalarValue::try_from_array(&array, 0)?,
Review Comment:
Thanks, I could reproduce that. `ListView` and `LargeListView` now wrap the
one-row array directly, like the other list types. The metadata test now covers
`List`, `ListView` and `LargeListView`. With the two new arms removed, it fails
on `ListView` because the evaluated type has no metadata.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]