Jefffrey commented on code in PR #22980:
URL: https://github.com/apache/datafusion/pull/22980#discussion_r3486045540
##########
datafusion/common/src/nested_struct.rs:
##########
@@ -264,6 +272,72 @@ fn cast_list_view_column<O: arrow::array::OffsetSizeTrait>(
Ok(Arc::new(result))
}
+fn cast_fixed_size_list_column(
+ source_col: &ArrayRef,
+ target_inner_field: &FieldRef,
+ target_list_size: i32,
+ cast_options: &CastOptions,
+) -> Result<ArrayRef> {
+ let source_list =
+ downcast_array!(source_col, FixedSizeListArray, "fixed-size list
array")?;
+
+ let source_values = source_list.values();
+ let target_type = target_inner_field.data_type();
+
+ validate_data_type_compatibility(
Review Comment:
I still don't think we need to compatibility check again here on this path,
as we're just meant to be casting at this point 🤔
##########
datafusion/common/src/nested_struct.rs:
##########
@@ -264,6 +272,72 @@ fn cast_list_view_column<O: arrow::array::OffsetSizeTrait>(
Ok(Arc::new(result))
}
+fn cast_fixed_size_list_column(
+ source_col: &ArrayRef,
+ target_inner_field: &FieldRef,
+ target_list_size: i32,
+ cast_options: &CastOptions,
+) -> Result<ArrayRef> {
+ let source_list =
+ downcast_array!(source_col, FixedSizeListArray, "fixed-size list
array")?;
+
+ let source_values = source_list.values();
+ let target_type = target_inner_field.data_type();
+
+ validate_data_type_compatibility(
+ target_inner_field.name(),
+ source_values.data_type(),
+ target_type,
+ )?;
+
+ let cast_values = match cast_column(source_values, target_type,
cast_options) {
+ Ok(cast_values) => cast_values,
+ Err(error) => match source_list.nulls() {
+ Some(parent_nulls) if parent_nulls.null_count() > 0 => {
+ let hidden_child_nulls = parent_nulls.expand(target_list_size
as usize);
+ let masked_values =
Review Comment:
This is interesting; it technically applies for the other list methods too
but those would be rare cases where the null slots are non-empty (and have
values that would error on cast), not to mention this would only occur when
cast options has `safe=false`
Also I think this can also occur in the arrow-rs upstream cast code, so
might need to raise an issue there too 🤔
--
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]