blaginin commented on code in PR #13452:
URL: https://github.com/apache/datafusion/pull/13452#discussion_r1847145537
##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -1138,27 +1138,44 @@ fn numeric_string_coercion(lhs_type: &DataType,
rhs_type: &DataType) -> Option<D
}
}
+fn coerce_list_children(lhs_field: &FieldRef, rhs_field: &FieldRef) ->
Option<FieldRef> {
+ Some(Arc::new(
+
Arc::unwrap_or_clone(Arc::clone(lhs_field)).with_data_type(comparison_coercion(
Review Comment:
I may have misunderstood your point, but I am pretty sure
`comparison_coercion` preserves dicts:
https://github.com/apache/datafusion/blob/22c1f54411a02009629b3a76a43bd4343add045d/datafusion/expr-common/src/type_coercion/binary.rs#L637
For example, this query correctly casts `Dict(Utf8)` to `Dict(LargeUtf8)`
```sql
select arrow_typeof(x) from (select make_array(arrow_cast('a',
'Dictionary(Int8, Utf8)')) x UNION ALL SELECT make_array(arrow_cast('b',
'Dictionary(Int8, LargeUtf8)'))) x;
```
Also, I think `type_union_resolution` is a bit more limiting than
`comparison_coercion`, and so, for example, if I switch to it, the following
two queries will stop working:
```sql
-- type_union_resolution can't cast nulls
select make_array(arrow_cast('a', 'Utf8')) x UNION ALL SELECT
make_array(NULL) x;
-- type_union_resolution can't handle large lists (or fixed lists)
select make_array(make_array(1)) x UNION ALL SELECT
make_array(arrow_cast(make_array(-1), 'LargeList(Int8)')) x;
```
--
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]