Acfboy commented on code in PR #20241:
URL: https://github.com/apache/datafusion/pull/20241#discussion_r2788974736
##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -470,7 +470,7 @@ fn bitwise_coercion(left_type: &DataType, right_type:
&DataType) -> Option<DataT
return None;
}
- if left_type == right_type {
+ if left_type == right_type && left_type.is_integer() {
Review Comment:
Sorry for the oversight. I agree that identical integer Dictionaries should
pass.
However, one thing puzzles me:
- In the original implementation, while identical Dictionary types passed
the check, Dictionary(Int8, Int32) & Dictionary(Int32, Int32) would error out
immediately.
- In contrast, operations like Plus allow different Dictionary index types.
I suspect this is because Plus unpack the dictionary and coerces them to
their internal value type, which triggers a cast back to that type during
rewrite phase ((Dict(Int8, Int32) + (Dict(int32, int32)) --cast--> (Int32 +
Int32)). While bitwise operations might aim for direct execution between
Dictionaries to preserve performance.
But we could still coerce their internal value types ((Dict(Int8, Int32) &
(Dict(int32, int32)) --cast--> (Dict(Int32, Int32) & (Dict(int32, int32)). I'm
curious why this wasn't implemented before? Is it another oversight that I can
fix it 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]