Skip to content
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

opt: minor fix for ExtractJoinEquality rule #44788

Merged
merged 1 commit into from
Feb 7, 2020

Conversation

RaduBerinde
Copy link
Member

The ExtractJoinEquality rule does not fire if one of the equality
sides are ConstValue. But it is possible for an expression to have
no outer columns without it being a constant value (e.g. because
constant folding failed). In this case the rule gets confused and
incorrectly pushes down a projection to the wrong side.

Fixes #44746.

Release note (bug fix): fixed a "cannot map variable" error in some
rare cases involving joins.

Thanks to @mrigger for finding this bug.

The `ExtractJoinEquality` rule does not fire if one of the equality
sides are `ConstValue`. But it is possible for an expression to have
no outer columns without it being a constant value (e.g. because
constant folding failed). In this case the rule gets confused and
incorrectly pushes down a projection to the wrong side.

Fixes cockroachdb#44746.

Release note (bug fix): fixed a "cannot map variable" error in some
rare cases involving joins.
@RaduBerinde RaduBerinde requested a review from a team as a code owner February 6, 2020 01:22
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andy-kimball)

@RaduBerinde
Copy link
Member Author

bors r+

craig bot pushed a commit that referenced this pull request Feb 7, 2020
44788: opt: minor fix for ExtractJoinEquality rule r=RaduBerinde a=RaduBerinde

The `ExtractJoinEquality` rule does not fire if one of the equality
sides are `ConstValue`. But it is possible for an expression to have
no outer columns without it being a constant value (e.g. because
constant folding failed). In this case the rule gets confused and
incorrectly pushes down a projection to the wrong side.

Fixes #44746.

Release note (bug fix): fixed a "cannot map variable" error in some
rare cases involving joins.

Thanks to @mrigger for finding this bug.

Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Feb 7, 2020

Build succeeded

@craig craig bot merged commit 874a28e into cockroachdb:master Feb 7, 2020
@RaduBerinde RaduBerinde deleted the fix-join-extract-eq branch February 7, 2020 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FULL JOIN with an SUBSTRING ON clause results in an internal error
3 participants