Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,17 @@ select pg_typeof(false or true), pg_typeof(true or false);
bool bool


# TODO: run for DataFusion as well after #4335
onlyif postgres
query ??
select null and null, null or null;
----
NULL NULL


# TODO: uncomment after #4335
#onlyif DataFusion
#query ??
#select arrow_typeof(null and null), arrow_typeof(null or null);
#----
#Boolean Boolean
onlyif DataFusion
query ??
select arrow_typeof(null and null), arrow_typeof(null or null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

----
Boolean Boolean


onlyif postgres
Expand Down
6 changes: 3 additions & 3 deletions datafusion/expr/src/type_coercion/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn coerce_types(
Operator::And | Operator::Or => match (lhs_type, rhs_type) {
// logical binary boolean operators can only be evaluated in bools or nulls
(DataType::Boolean, DataType::Boolean) => Some(DataType::Boolean),
(DataType::Null, DataType::Null) => Some(DataType::Null),
(DataType::Null, DataType::Null) => Some(DataType::Boolean),
(DataType::Boolean, DataType::Null) | (DataType::Null, DataType::Boolean) => {
Some(DataType::Boolean)
}
Expand Down Expand Up @@ -1147,13 +1147,13 @@ mod tests {
DataType::Null,
DataType::Null,
Operator::Or,
DataType::Null
DataType::Boolean
);
test_coercion_binary_rule!(
DataType::Null,
DataType::Null,
Operator::And,
DataType::Null
DataType::Boolean
);
test_coercion_binary_rule!(
DataType::Null,
Expand Down