This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 2887491fc6 fix: set `null_equals_null` to false when
`convert_cross_join_to_inner_join` (#11738)
2887491fc6 is described below
commit 2887491fc63c5084abf7eef644618b57172480bf
Author: Jonah Gao <[email protected]>
AuthorDate: Thu Aug 1 00:20:50 2024 +0800
fix: set `null_equals_null` to false when
`convert_cross_join_to_inner_join` (#11738)
---
datafusion/optimizer/src/push_down_filter.rs | 2 +-
datafusion/sqllogictest/test_files/join.slt | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/datafusion/optimizer/src/push_down_filter.rs
b/datafusion/optimizer/src/push_down_filter.rs
index ecad3404d5..f9c9ec961c 100644
--- a/datafusion/optimizer/src/push_down_filter.rs
+++ b/datafusion/optimizer/src/push_down_filter.rs
@@ -1127,7 +1127,7 @@ fn convert_cross_join_to_inner_join(cross_join:
CrossJoin) -> Result<Join> {
on: vec![],
filter: None,
schema: DFSchemaRef::new(join_schema),
- null_equals_null: true,
+ null_equals_null: false,
})
}
diff --git a/datafusion/sqllogictest/test_files/join.slt
b/datafusion/sqllogictest/test_files/join.slt
index 84aeb3ebd7..29f1c4384d 100644
--- a/datafusion/sqllogictest/test_files/join.slt
+++ b/datafusion/sqllogictest/test_files/join.slt
@@ -1108,4 +1108,26 @@ statement ok
DROP TABLE t0;
statement ok
-DROP TABLE t1;
\ No newline at end of file
+DROP TABLE t1;
+
+# Test SQLancer issue: https://github.com/apache/datafusion/issues/11704
+query II
+WITH
+ t1 AS (SELECT NULL::int AS a),
+ t2 AS (SELECT NULL::int AS a)
+SELECT * FROM
+ (SELECT * FROM t1 CROSS JOIN t2)
+WHERE t1.a == t2.a
+ AND t1.a + t2.a IS NULL;
+----
+
+# Similar to above test case, but without the equality predicate
+query II
+WITH
+ t1 AS (SELECT NULL::int AS a),
+ t2 AS (SELECT NULL::int AS a)
+SELECT * FROM
+ (SELECT * FROM t1 CROSS JOIN t2)
+WHERE t1.a + t2.a IS NULL;
+----
+NULL NULL
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]