-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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 histogram filtering with infinite upper bound #100763
Conversation
b54760a
to
a3b79b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @rytaft)
pkg/sql/opt/props/histogram.go
line 754 at r1 (raw file):
// to the new bucket. numRange = b.NumRange * rangeAfter / rangeBefore if !math.IsNaN(numRange) {
Does this happen because rangeAfter
is NaN? Or Infinity?
Previously, michae2 (Michael Erickson) wrote…
It happens when both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: complete! 2 of 0 LGTMs obtained (waiting on @michae2)
This commit fixes a bug that caused the filtering a histogram bucket with an infinite upper bound to produce a bucket with a `numRange` of `NaN`. This led to bad query plans because the `NaN` did not reduce the input expression's row count at all. Fixes cockroachdb#100582 Release note (bug fix): A bug has been fixed that caused suboptimal query plans when a table contained infinite values, like `'+Infinity'::DECIMAL`. This bug is present since versions v22.1, and likely earlier. It could also be triggered in rare cases when table statistics forecasts created a forecasted bucket with an infinite value.
a3b79b5
to
7b8ad4c
Compare
TFTRs! bors r+ |
Build succeeded: |
This commit fixes a bug that caused the filtering a histogram bucket
with an infinite upper bound to produce a bucket with a
numRange
ofNaN
. This led to bad query plans because theNaN
did not reduce theinput expression's row count at all.
Fixes #100582
Release note (bug fix): A bug has been fixed that caused suboptimal
query plans when a table contained infinite values, like
'+Infinity'::DECIMAL
. This bug is present since versions v22.1, andlikely earlier. It could also be triggered in rare cases when table
statistics forecasts created a forecasted bucket with an infinite value.