Closed colorfulu closed 2 years ago
-- Q1
SELECT c_0_0
FROM t0
WHERE
(
((c_0_4 != c_0_4) IN
(
SELECT c_1_0 FROM t1 WHERE c_0_1 = '1970-01-04'
)
) IS NULL
)
-- Q2
SELECT c_0_0
FROM t0
WHERE
( NOT
((c_0_4 != c_0_4) IN
(
SELECT c_1_0 FROM t1 WHERE c_0_1 = '1970-01-04'
)
)
)
Q1 is expected to output 0 rows and Q2 is expected to output 4 rows
But actually Q1 output 2 rows and Q2 output 4 rows
The corresponding sql equivalent to Q1 is
WITH xx AS
(SELECT t1.c_1_0 AS v2,
'1970-01-04' AS v3
FROM t1)
SELECT t0.c_0_0,
CASE
WHEN t1Rows = 0 THEN FALSE
WHEN (c_0_4 != c_0_4) IS NULL THEN NULL
WHEN t1d.v2 IS NOT NULL THEN TRUE
WHEN v2Nulls < t1Rows THEN NULL
ELSE FALSE
END
FROM t0
LEFT OUTER JOIN
(SELECT xx.v2,
xx.v3
FROM xx
GROUP BY xx.v2,
xx.v3) AS t1d ON (c_0_4 != c_0_4)=t1d.v2
AND t0.c_0_1 = t1d.v3
LEFT OUTER JOIN
(SELECT count(*) AS t1Rows,
count(xx.v2) AS v2Nulls,
xx.v3
FROM xx
GROUP BY xx.v3) AS t1c ON t1c.v3 = t0.c_0_1
..
Steps to reproduce the behavior (Required)
Expected behavior (Required)
Real behavior (Required)
StarRocks version (Required)
select current_version()