Skip to content

opt: fix panic in findJoinFilterRange#69013

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
mgartner:68975-fix-join-range-panic
Aug 17, 2021
Merged

opt: fix panic in findJoinFilterRange#69013
craig[bot] merged 1 commit intocockroachdb:masterfrom
mgartner:68975-fix-join-range-panic

Conversation

@mgartner
Copy link
Copy Markdown
Contributor

@mgartner mgartner commented Aug 16, 2021

This commit fixes a panic produced in findJoinFilterRange when
attempting to access the 0-th constraint in an empty constraint set.

Fixes #68975

There is no release note because the bug is not present in any releases.

Release note: None

@mgartner mgartner requested review from a team, cucaroach and rytaft August 16, 2021 20:32
@mgartner mgartner requested a review from a team as a code owner August 16, 2021 20:32
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
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.

nit: in the commit / PR message: "There is no release not" -> "There is no release note"

:lgtm:

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


pkg/sql/opt/xform/join_funcs.go, line 1184 at r1 (raw file):

	for filterIdx := range filters {
		props := filters[filterIdx].ScalarProps()
		if props.TightConstraints && props.Constraints.Length() > 0 && !props.Constraints.IsUnconstrained() {

nit: you can remove the check for !props.Constraints.IsUnconstrained(), since an unconstrained Set also has length 0.

This commit fixes a panic produced in `findJoinFilterRange` when
attempting to access the 0-th constraint in an empty constraint set.

Fixes cockroachdb#68975

There is no release note because the bug is not present in any releases.

Release note: None
@mgartner mgartner force-pushed the 68975-fix-join-range-panic branch from ca3fc0a to c96618d Compare August 16, 2021 21:16
Copy link
Copy Markdown
Contributor 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.

nit: in the commit / PR message: "There is no release not" -> "There is no release note"

Fixed.

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


pkg/sql/opt/xform/join_funcs.go, line 1184 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

nit: you can remove the check for !props.Constraints.IsUnconstrained(), since an unconstrained Set also has length 0.

Done.

Copy link
Copy Markdown
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.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @cucaroach)

@mgartner
Copy link
Copy Markdown
Contributor Author

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 17, 2021

Build succeeded:

@craig craig bot merged commit 5d2c91c into cockroachdb:master Aug 17, 2021
@mgartner mgartner deleted the 68975-fix-join-range-panic branch August 18, 2021 01:27
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.

roachtest: sqlsmith/setup=empty/setting=default failed

3 participants