Skip to content

Unexpected result when using IS DISTINCT FROM with RIGHT JOIN #7527

Description

@suyZhong

Describe the bug
The IS DISTINCT FROM operator in MonetDB returns unexpected results when used with RIGHT JOIN. Specifically, the IS DISTINCT FROM condition should correctly evaluate to true for NULL values in t1.c1, thus not filtering out the rows from the result set. However, the actual result is an empty table, indicating a potential issue with the IS DISTINCT FROM evaluation in the presence of NULL values during a RIGHT JOIN.

To Reproduce

DROP TABLE IF EXISTS t0 CASCADE;
DROP TABLE IF EXISTS t1 CASCADE;

CREATE TABLE t0(c0 INT);
CREATE TABLE t1(c1 INT);
INSERT INTO t0 (c0) VALUES (0);

SELECT * FROM t1 RIGHT  JOIN t0 ON true; -- null 0
SELECT (1 IS DISTINCT FROM t1.c1) FROM t1 RIGHT  JOIN t0 ON true ; -- true
SELECT * FROM t1 RIGHT  JOIN t0 ON true WHERE (1 IS DISTINCT FROM t1.c1);
-- Expected: null 0
-- Actual: empty table

Expected behavior
As mentioned above.

Screenshots
N/A

Software versions
Build from source:

> docker exec -it monetdb-test mserver5 --version         
MonetDB 5 server 11.50.0 (hg id: 389e974) (64-bit, 128-bit integers)
This is an unreleased version
Copyright (c) 1993 - July 2008 CWI
Copyright (c) August 2008 - 2023 MonetDB B.V., all rights reserved
Visit https://www.monetdb.org/ for further information
Found 503.5GiB available memory, 128 available cpu cores
Libraries:
Compiled by: @efa472fb0bee (x86_64-pc-linux-gnu)
Compilation: /usr/bin/cc 
Linking    : /usr/bin/ld

Issue labeling
Bug

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions