jayzhan211 commented on code in PR #13452:
URL: https://github.com/apache/datafusion/pull/13452#discussion_r1850200368
##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -1138,27 +1134,46 @@ fn numeric_string_coercion(lhs_type: &DataType,
rhs_type: &DataType) -> Option<D
}
}
+/// Coerces two fields together, ensuring the field data (name and
nullability) is correctly set.
+fn coerce_list_children(lhs_field: &FieldRef, rhs_field: &FieldRef) ->
Option<FieldRef> {
+ let data_types = vec![lhs_field.data_type().clone(),
rhs_field.data_type().clone()];
+ Some(Arc::new(
+ (**lhs_field)
+ .clone()
+ .with_data_type(type_union_resolution(&data_types)?)
+ .with_nullable(lhs_field.is_nullable() || rhs_field.is_nullable()),
+ ))
+}
+
/// Coercion rules for list types.
fn list_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataType>
{
use arrow::datatypes::DataType::*;
match (lhs_type, rhs_type) {
- (List(_), List(_)) => Some(lhs_type.clone()),
- (LargeList(_), List(_)) => Some(lhs_type.clone()),
- (List(_), LargeList(_)) => Some(rhs_type.clone()),
- (LargeList(_), LargeList(_)) => Some(lhs_type.clone()),
- (List(_), FixedSizeList(_, _)) => Some(lhs_type.clone()),
- (FixedSizeList(_, _), List(_)) => Some(rhs_type.clone()),
+ (
+ LargeList(lhs_field),
+ List(rhs_field) | LargeList(rhs_field) | FixedSizeList(rhs_field,
_),
Review Comment:
Is ListView already supported in arrow? I would prefer to handle list view
if there is corresponding test as well.
--
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]