Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4, 11.8
-
None
-
ubuntu 22.04
Description
CREATE TABLE IF NOT EXISTS t0(c0 FLOAT);
CREATE TABLE IF NOT EXISTS t1 LIKE t0;
SET SESSION internal_tmp_mem_storage_engine = MEMORY;
DROP INDEX c0 ON t1;
INSERT INTO t1(c0) VALUES(NULL);
INSERT INTO t1(c0) VALUES(NULL);
INSERT INTO t1(c0) VALUES(1);
INSERT INTO t1(c0) VALUES(2);
UPDATE t1 SET c0=(IF(t1.c0, NULL, t1.c0)) IS FALSE;
UPDATE t1 SET c0=COALESCE((- (t1.c0)), (3) IS TRUE);
INSERT INTO t0(c0) VALUES(NULL);
INSERT INTO t0(c0) VALUES(NULL);
INSERT INTO t0(c0) VALUES("0");
INSERT INTO t0(c0) VALUES(4);
INSERT INTO t0(c0) VALUES(5);
INSERT INTO t0(c0) VALUES(6);
SELECT t0.c0 FROM t0 WHERE NOT EXISTS (SELECT 1 FROM t1 WHERE t0.c0 = t1.c0);
–
SELECT t0.c0 FROM t0 WHERE EXISTS (SELECT 1 FROM t1 WHERE t0.c0 = t1.c0);
--{ 0 }
SELECT t0.c0 FROM t0;
–{ NULL, NULL, 0, 4, 5, 6 }
When using the same join conditions, the output of semi-join and anti-join are contradictory. This indicates that semi join produce wrong results.
In simpler terms:
11.4 ef966af801afc2a07222b5df65dddd52c77431dd
c0 c0
0 -0
0 -0
c0
NULL
NULL
0
4
c0
0
The issue here is the 0 row which appears in both result sets. So, it's about comparing float 0 to -0.
I'll leave it to psergei or maybe bar to decide how much of a problem it is.
The difference currently shows with default settings on 11.4 and higher, originally starting from 11.0, but that's probably because the plan changed in 11.0 along with big optimizer changes. I suppose if the same plans are triggered on earlier versions, the result could be the same.
11.4 ef966af801afc2a07222b5df65dddd52c77431dd
Warnings:
Warnings: