Skip to content

opt: fix bug and add setting for InlineAnyProjectSet#161880

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
DrewKimball:inline-unnest-any
Jan 30, 2026
Merged

opt: fix bug and add setting for InlineAnyProjectSet#161880
craig[bot] merged 3 commits intocockroachdb:masterfrom
DrewKimball:inline-unnest-any

Conversation

@DrewKimball
Copy link
Copy Markdown
Collaborator

opt: fix bug in InlineAnyProjectSet

The recently introduced InlineAnyProjectSet norm rule has a bug when the
input array is NULL - it returns NULL instead of false as the originally
matched expression would. The fix is simple - just AND the replacement
expression with an IS NOT NULL check. This flips the NULL to false in the
problem case only.

There is no release note, since the bug didn't make it into any release.

Fixes #161871

Release note: None

opt: gate new norm rule behind session setting

This commit adds a session setting optimizer_inline_any_unnest_subquery
to gate the new optimizer rule InlineAnyProjectSet in case we want
to backport. The setting is off by default, and will be switched on
in the next commit.

Informs #161871

Release note (sql change): Added a session setting to enable/disable the
optimizer rule InlineAnyProjectSet. The session setting is
optimizer_inline_any_unnest_subquery, and will be on by default in 26.2+.

opt: turn on InlineAnyProjectSet rule by default

This commit flips the session variable introduced in the previous
commit.

Informs #161871

Release note: None

The recently introduced InlineAnyProjectSet norm rule has a bug when the
input array is NULL - it returns NULL instead of false as the originally
matched expression would. The fix is simple - just AND the replacement
expression with an IS NOT NULL check. This flips the NULL to false in the
problem case only.

There is no release note, since the bug didn't make it into any release.

Fixes cockroachdb#161871

Release note: None
This commit adds a session setting optimizer_inline_any_unnest_subquery
to gate the new optimizer rule InlineAnyProjectSet in case we want
to backport. The setting is off by default, and will be switched on
in the next commit.

Informs cockroachdb#161871

Release note (sql change): Added a session setting to enable/disable the
optimizer rule InlineAnyProjectSet. The session setting is
optimizer_inline_any_unnest_subquery, and will be on by default in 26.2+.
This commit flips the session variable introduced in the previous
commit.

Informs cockroachdb#161871

Release note: None
@DrewKimball DrewKimball requested review from a team and michae2 January 27, 2026 19:16
@DrewKimball DrewKimball requested a review from a team as a code owner January 27, 2026 19:16
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@michae2 michae2 left a comment

Choose a reason for hiding this comment

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

:lgtm: Nice job!

@michae2 reviewed 10 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball).

@DrewKimball
Copy link
Copy Markdown
Collaborator Author

TFTR!

bors r=michae2

@craig
Copy link
Copy Markdown
Contributor

craig Bot commented Jan 30, 2026

@craig craig Bot merged commit a60f784 into cockroachdb:master Jan 30, 2026
60 of 70 checks passed
@DrewKimball DrewKimball deleted the inline-unnest-any branch January 30, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opt: edge case bug in new inline rule

3 participants