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: fix constant columns bug in zig-zag join rule #48128

Merged
merged 1 commit into from
Apr 29, 2020

Conversation

RaduBerinde
Copy link
Member

This is a fix for a regression introduced by #47412.

We were using ExtractConstCols to get the list of possible fixed
columns, and later we were using findConstantFilter to get the values.
The latter has more restrictive semantics so we wouldn't always find
the value we need.

The fix is to use logic consistent with ExtractConstCols, which is
now added as ExtractValueForConstColumn. The zig-zag join code now
also verifies that we fill in all the columns so we get a better error
earlier.

Fixes #48003.

Release note (bug fix): Fixed "non-values node passed as fixed value
to zigzag join" internal error.

@RaduBerinde RaduBerinde requested a review from a team as a code owner April 28, 2020 21:04
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@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.

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

a discussion (no related file):
:lgtm:


Copy link
Contributor

@andy-kimball andy-kimball left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @RaduBerinde and @rytaft)

a discussion (no related file):

Previously, mgartner (Marcus Gartner) wrote…

:lgtm:

:lgtm:



pkg/sql/opt/constraint/constraint_set.go, line 294 at r1 (raw file):

// ExtractValueForConstColumn extracts the value for a constant column returned
// by ExtractConstCols.
func (s *Set) ExtractValueForConstColumn(evalCtx *tree.EvalContext, col opt.ColumnID) tree.Datum {

NIT: would call this ExtractValueForConstCol for symmetry.

This is a fix for a regression introduced by cockroachdb#47412.

We were using `ExtractConstCols` to get the list of possible fixed
columns, and later we were using `findConstantFilter` to get the values.
The latter has more restrictive semantics so we wouldn't always find
the value we need.

The fix is to use logic consistent with `ExtractConstCols`, which is
now added as `ExtractValueForConstColumn`. The zig-zag join code now
also verifies that we fill in all the columns so we get a better error
earlier.

Fixes cockroachdb#48003.

Release note (bug fix): Fixed "non-values node passed as fixed value
to zigzag join" internal error.
Copy link
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

TFTRs!

bors r+

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

@craig
Copy link
Contributor

craig bot commented Apr 29, 2020

Build succeeded

@craig craig bot merged commit a0d78db into cockroachdb:master Apr 29, 2020
@RaduBerinde RaduBerinde deleted the fix-zig-zag-bug branch May 1, 2020 14:56
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.

sql/logictest: TestSqlLiteLogic failed
4 participants