martin-g commented on code in PR #20241:
URL: https://github.com/apache/datafusion/pull/20241#discussion_r2788090572


##########
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:
   What about dictionary encoded integers ? Should they be supported too ?



##########
datafusion/expr-common/src/type_coercion/binary/tests/arithmetic.rs:
##########
@@ -228,6 +228,37 @@ fn test_type_coercion_arithmetic() -> Result<()> {
     Ok(())
 }
 
+#[test]
+fn test_bitwise_coercion_float_types_error() -> Result<()> {
+    let err = BinaryTypeCoercer::new(
+        &DataType::Float32,
+        &Operator::BitwiseAnd,
+        &DataType::Float32,
+    )
+    .get_input_types()
+    .unwrap_err()
+    .to_string();
+    assert_contains!(
+        &err,
+        "Cannot infer common type for bitwise operation Float32 & Float32"
+    );
+
+    let err = BinaryTypeCoercer::new(
+        &DataType::Float32,
+        &Operator::BitwiseAnd,
+        &DataType::Float64,
+    )
+    .get_input_types()
+    .unwrap_err()
+    .to_string();
+    assert_contains!(
+        &err,
+        "Cannot infer common type for bitwise operation Float32 & Float64"
+    );
+
+    Ok(())
+}
+

Review Comment:
   nit: Maybe add a test case for Decimals too, since they are also numeric 
types.



-- 
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]

Reply via email to