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: corrects function doc for canMaybeConstrainIndex #47232

Merged

Conversation

mgartner
Copy link
Collaborator

@mgartner mgartner commented Apr 8, 2020

opt: corrects function doc for canMaybeConstrainIndex

This commit corrects a the function documentation for
canMaybeConstrainIndex.

Prior to this change, it did not mention a third check, for tight filter
constraints, that is performed to determinte the possibility that an
index could be constrained by a filer.

Also, the documentation now correctly maps to the logic of the function.
Previously it falsly claimed that if any of the checks were false then
the function would return false. Now it correctly states that if any of
the checks are true, then the fucntion returns true.

Release note: None

@mgartner mgartner requested a review from a team as a code owner April 8, 2020 21:55
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

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

:lgtm:

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


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

}

// canMaybeConstrainIndex can quickly rule out the possibility that the given

[nit] I would keep "performs checks", the new description suggests the opposite semantics

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 1 of 1 files at r1.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @mgartner)


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

//
//   1. The filter references the first index column.
//   2. The constraints are not tight (see Scalar.TightConstraints).

[nit] I'd say props.Scalar.TightConstraints since props is a different package than this one.

@mgartner mgartner force-pushed the correct-can-maybe-constrain-index-comment branch from 5e23169 to 0e822c4 Compare April 8, 2020 22:29
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.

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


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

Previously, RaduBerinde wrote…

[nit] I would keep "performs checks", the new description suggests the opposite semantics

I updated this first sentence. Let me know if this is ok. Happy to adjust until it is clear.

The new description is intentionally the opposite of what it was before, because the function returns true if any of the checks are true. So "ruling out" seemed not accurate. It is ruled out of all of the checks fail.


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

Previously, rytaft (Rebecca Taft) wrote…

[nit] I'd say props.Scalar.TightConstraints since props is a different package than this one.

👍

@blathers-crl
Copy link

blathers-crl bot commented Apr 8, 2020

❌ The GitHub CI (Cockroach) build has failed on 0e822c44.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. I am experimental - my owner is otan.

@RaduBerinde
Copy link
Member


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

Previously, mgartner (Marcus Gartner) wrote…

I updated this first sentence. Let me know if this is ok. Happy to adjust until it is clear.

The new description is intentionally the opposite of what it was before, because the function returns true if any of the checks are true. So "ruling out" seemed not accurate. It is ruled out of all of the checks fail.

"X can rule out" suggests that X returns true when it rules out something. I'd say "canMaybeCobstrainIndex returns ttrue if we should try to constrain a given index. It can quickly rule out.." Up to you though, I realize I'm bikeshedding here

This commit corrects the function documentation for
canMaybeConstrainIndex.

Prior to this change, it did not mention a third check, for tight filter
constraints, that is performed to determine the possibility that an
index could be constrained by a filer.

Also, the documentation now correctly maps to the logic of the function.
Previously it falsely claimed that if any of the checks were false then
the function would return false. Now it correctly states that if any of
the checks are true, then the function returns true.

Release note: None
@mgartner mgartner force-pushed the correct-can-maybe-constrain-index-comment branch from 0e822c4 to c6423e9 Compare April 9, 2020 00:15
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.

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


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

Previously, RaduBerinde wrote…

"X can rule out" suggests that X returns true when it rules out something. I'd say "canMaybeCobstrainIndex returns ttrue if we should try to constrain a given index. It can quickly rule out.." Up to you though, I realize I'm bikeshedding here

I agree with you. I took out the "rule out" language entirely to avoid confusion. Now it more clearly state when it returns true and when it returns false.

Copy link
Member

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

:lgtm:

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

@mgartner
Copy link
Collaborator Author

mgartner commented Apr 9, 2020

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 9, 2020

Build succeeded

@craig craig bot merged commit 3967538 into cockroachdb:master Apr 9, 2020
@mgartner mgartner deleted the correct-can-maybe-constrain-index-comment branch April 9, 2020 17:49
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.

4 participants