Skip to content

Conversation

@mgartner
Copy link
Collaborator

@mgartner mgartner commented Nov 5, 2025

This commit fixes a bug in the vectorized engine that caused internal
errors 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 LHS or RHS of an operator is NULL by simply projecting NULLs.
This is similar to the change made in #128123 and addresses a TODO added
in that PR.

This code path is unlikely to hit (maybe impossible) without generic
query plans. In an optimized cusotm plan, the optimizer will fold
expressions with NULL values at optimization time, and the execution
engine will never see expressions of this form.

Fixes #152771

Release note (bug fix): A bug has been fixed that could cause internal
errors for queries using generic query plans with NULL placeholder
values.

@mgartner mgartner requested review from a team and yuzefovich November 5, 2025 20:17
@mgartner mgartner requested a review from a team as a code owner November 5, 2025 20:17
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@mgartner mgartner added backport-25.2.x Flags PRs that need to be backported to 25.2 backport-25.3.x Flags PRs that need to be backported to 25.3 backport-25.4.x Flags PRs that need to be backported to 25.4 labels Nov 5, 2025
Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! :lgtm:

@yuzefovich reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @mgartner)


-- commits line 19 at r1:
nit: maybe mention NULLs somehow to make the note more specific.

This commit fixes a bug in the vectorized engine that caused internal
errors 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 LHS or RHS of an operator is NULL by simply projecting NULLs.
This is similar to the change made in cockroachdb#128123 and addresses a TODO added
in that PR.

This code path is unlikely to hit (maybe impossible) without generic
query plans. In an optimized cusotm plan, the optimizer will fold
expressions with `NULL` values at optimization time, and the execution
engine will never see expressions of this form.

Fixes cockroachdb#152771

Release note (bug fix): A bug has been fixed that could cause internal
errors for queries using generic query plans with `NULL` placeholder
values.
@mgartner mgartner force-pushed the 152771-fix-vectorized-project branch from b78cd45 to 6c8a11b Compare November 5, 2025 21:32
Copy link
Collaborator Author

@mgartner mgartner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @mgartner)


-- commits line 19 at r1:

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: maybe mention NULLs somehow to make the note more specific.

Done.

craig bot pushed a commit that referenced this pull request Nov 5, 2025
156962: colexec: fix projections with constant NULL values r=mgartner a=mgartner

This commit fixes a bug in the vectorized engine that caused internal
errors 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 LHS or RHS of an operator is NULL by simply projecting NULLs.
This is similar to the change made in #128123 and addresses a TODO added
in that PR.

This code path is unlikely to hit (maybe impossible) without generic
query plans. In an optimized cusotm plan, the optimizer will fold
expressions with `NULL` values at optimization time, and the execution
engine will never see expressions of this form.

Fixes #152771

Release note (bug fix): A bug has been fixed that could cause internal
errors for queries using generic query plans with `NULL` placeholder
values.


156969: roachtest: disable max object count for large_schema_benchmark r=rafiss a=rafiss

This test is intentionally using a large number of tables, so we should disable the guardrail.

fixes #156188
fixes #156721

Release note: None

Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Nov 5, 2025

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Nov 6, 2025

@craig craig bot merged commit 1799dba into cockroachdb:master Nov 6, 2025
25 checks passed
@blathers-crl
Copy link

blathers-crl bot commented Nov 6, 2025

Based on the specified backports for this PR, I applied new labels to the following linked issue(s). Please adjust the labels as needed to match the branches actually affected by the issue(s), including adding any known older branches.


Issue #152771: branch-release-25.2, branch-release-25.3, branch-release-25.4.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-25.2.x Flags PRs that need to be backported to 25.2 backport-25.3.x Flags PRs that need to be backported to 25.3 backport-25.4.x Flags PRs that need to be backported to 25.4 target-release-26.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected error in prepared statement

3 participants