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
1 change: 1 addition & 0 deletions datafusion/sql/src/expr/binary_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
BinaryOperator::StringConcat => Ok(Operator::StringConcat),
BinaryOperator::ArrowAt => Ok(Operator::ArrowAt),
BinaryOperator::AtArrow => Ok(Operator::AtArrow),
BinaryOperator::Spaceship => Ok(Operator::IsNotDistinctFrom),
_ => not_impl_err!("Unsupported SQL binary operator {op:?}"),
}
}
Expand Down
56 changes: 56 additions & 0 deletions datafusion/sqllogictest/test_files/expr.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,62 @@ select NULL < column1 from (VALUES (true), (false)) as t;
NULL
NULL

#### comparisons_with_spaceship_operator

# Basic comparisons
query B
select 1 <=> 1;
----
true

query B
select 1 <=> 2;
----
false

# NULL handling
query B
select NULL <=> NULL;
----
true

query B
select 1 <=> NULL;
----
false

query B
select NULL <=> 1;
----
false

# Table comparisons
query B
select column1 <=> column2 from (VALUES (1, 1), (2, 3), (NULL, NULL)) as t;
----
true
false
true

# Sanity test - comparing <=> with equivalent expression
query B
SELECT
(column1 <=> column2) =
(IFNULL(column1, false) = IFNULL(column2, false)) AS comparison_result
FROM (VALUES
(1, 1), -- equal values
(1, 2), -- different values
(NULL, NULL), -- both NULL
(1, NULL), -- first not NULL, second NULL
(NULL, 1) -- first NULL, second not NULL
) AS t(column1, column2);
----
true
true
true
true
true

#### binary_mathematical_operator_with_null_lt

# 1. Integer and NULL
Expand Down
Loading