-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
roachtest: tlp failure: false vs NULL #127814
Comments
Initial reduction: running this with:
|
Using that repro, this reproduces on v24.1.2 and v23.2.5, but not v23.1.21. So seems like it was a regression in v23.2. I'll remove release-blocker since this wasn't a recent regression. |
I believe this boils down to this interesting query result: CREATE TABLE t1 (
i INT
);
CREATE TABLE t2 (
o OID PRIMARY KEY
);
INSERT INTO t2 VALUES (0);
-- p: o NOT IN ((SELECT NULL FROM t1),)
SELECT
-- p
o NOT IN (
(SELECT NULL FROM t1),
),
-- NOT p
NOT (
o NOT IN (
(SELECT NULL FROM t1),
)
)
FROM t2;
-- ?column? | ?column?
-- -----------+-----------
-- t | NULL
-- (1 row) For some predicate If If |
Note that the trailing commas have semantic signficance: -- Same as above, without trailing commas.
SELECT
-- p
o NOT IN (
(SELECT NULL FROM t1)
),
-- NOT p
NOT (
o NOT IN (
(SELECT NULL FROM t1)
)
)
FROM t2;
-- ?column? | ?column?
-- -----------+-----------
-- t | f
-- (1 row) The commas make the single-row result of the subquery an item in the CREATE TABLE t (i INT);
SELECT (SELECT i FROM t);
-- i
-- --------
-- NULL
-- (1 row) So the predicate |
It looks like there's a bug in the vectorized execution engine that is causing this. We get a correct result when forcing the row-by-row engine: CREATE TABLE t1 (
i INT
);
CREATE TABLE t2 (
o OID PRIMARY KEY
);
INSERT INTO t2 VALUES (0);
-- p: o NOT IN ((SELECT NULL FROM t1),)
SELECT
-- p
o NOT IN (
(SELECT NULL FROM t1),
),
-- NOT p
NOT (
o NOT IN (
(SELECT NULL FROM t1),
)
)
FROM t2;
-- ?column? | ?column?
-- -----------+-----------
-- t | NULL
-- (1 row)
SET vectorize=off;
-- p: o NOT IN ((SELECT NULL FROM t1),)
SELECT
-- p
o NOT IN (
(SELECT NULL FROM t1),
),
-- NOT p
NOT (
o NOT IN (
(SELECT NULL FROM t1),
)
)
FROM t2;
-- ?column? | ?column?
-- -----------+-----------
-- NULL | NULL
-- (1 row) |
This commit fixes a bug in the vectorized engine that caused incorrect results when projections operated on constant NULL values. The `proj_const_right_ops` operators do not correctly handle NULL inputs. So, we avoid these code paths when operator does not operate on NULL values and the RHS of an operator is NULL by simply projecting NULLs. Fixes cockroachdb#127814 Release note (bug fix): A bug has been fixed that could cause incorrect evaluation of scalar expressions involving `NULL` values in rare cases.
This commit fixes a bug in the vectorized engine that caused incorrect results when projections operated on constant NULL values. The `proj_const_right_ops` operators do not correctly handle NULL inputs. So, we avoid these code paths when operator does not operate on NULL values and the RHS of an operator is NULL by simply projecting NULLs. Fixes cockroachdb#127814 Release note (bug fix): A bug has been fixed that could cause incorrect evaluation of scalar expressions involving `NULL` values in rare cases.
@mgartner are you still working on this issue? |
Ya, I need to make some changes to #128123. I'll try to get to that this week. |
128123: colexec: fix projections with constant NULL values r=mgartner a=mgartner This commit fixes a bug in the vectorized engine that caused incorrect results when projections operated on constant NULL values. The `proj_const_right_ops` operators do not correctly handle NULL inputs. So, we avoid these code paths when operator does not operate on NULL values and the RHS of an operator is NULL by simply projecting NULLs. Fixes #127814 Release note (bug fix): A bug has been fixed that could cause incorrect evaluation of scalar expressions involving `NULL` values in rare cases. Co-authored-by: Marcus Gartner <[email protected]>
This commit fixes a bug in the vectorized engine that caused incorrect results when projections operated on constant NULL values. The `proj_const_right_ops` operators do not correctly handle NULL inputs. So, we avoid these code paths when operator does not operate on NULL values and the RHS of an operator is NULL by simply projecting NULLs. Fixes cockroachdb#127814 Release note (bug fix): A bug has been fixed that could cause incorrect evaluation of scalar expressions involving `NULL` values in rare cases.
This commit fixes a bug in the vectorized engine that caused incorrect results when projections operated on constant NULL values. The `proj_const_right_ops` operators do not correctly handle NULL inputs. So, we avoid these code paths when operator does not operate on NULL values and the RHS of an operator is NULL by simply projecting NULLs. Fixes cockroachdb#127814 Release note (bug fix): A bug has been fixed that could cause incorrect evaluation of scalar expressions involving `NULL` values in rare cases.
roachtest.tlp failed with artifacts on release-24.2 @ 742a2251a05088a238fc6eb4c2466dace3cb1bb2:
Parameters:
ROACHTEST_arch=amd64
ROACHTEST_cloud=gce
ROACHTEST_coverageBuild=false
ROACHTEST_cpu=4
ROACHTEST_encrypted=false
ROACHTEST_metamorphicBuild=false
ROACHTEST_ssd=0
Help
See: roachtest README
See: How To Investigate (internal)
See: Grafana
This test on roachdash | Improve this report!
Jira issue: CRDB-40618
The text was updated successfully, but these errors were encountered: