-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: nil presentation should not equal the 0-column presentation #39818
Conversation
We have seen a series of bugs where the execbuilder hits an assertion error inside Apply. This change adds a detail to the error containing the formatted opt tree. Release note: None
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @justinj, @RaduBerinde, and @rytaft)
pkg/sql/opt/memo/interner.go, line 525 at r2 (raw file):
func (h *hasher) HashPhysProps(val *physical.Required) { // Note: the Any presentation is not the same with the 0-column presentation.
nit: "is not the same as"?
pkg/sql/opt/props/physical/required.go, line 118 at r2 (raw file):
// presentation. func (p Presentation) Equals(rhs Presentation) bool { // The 0 column presentation is not the same with the nil presentation.
nit: same as? or "is not equal to"
The nil presentation means that we want all columns in no particular order, whereas the 0-column presentation means that we don't need any of the columns (e.g. EXISTS subqueries). Only the nil presentation is `Any()`. But `Equals()` was incorrectly treating these as equal. This confused the interner and a nil presentation became a 0-column presentation which led to some internal errors in Apply. For completeness, we also fix `HashPhysProps` to differentiate between these two, but note that this isn't required for correctness. Fixes cockroachdb#39435. Release note (bug fix): Fixed internal errors generated during execution of some complicated cases of correlated subqueries.
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @justinj and @rytaft)
pkg/sql/opt/memo/interner.go, line 525 at r2 (raw file):
Previously, justinj (Justin Jaffray) wrote…
nit: "is not the same as"?
In Soviet Russia, English learns you!
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 1 files at r1, 1 of 3 files at r2, 2 of 2 files at r3.
Reviewable status: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @justinj)
bors r+ |
39804: opt: add FK benchmarks r=RaduBerinde a=RaduBerinde Adding simple insert benchmarks comparing no FKs with the old FK path and the new one. The results are below. Note that we haven't yet optimized the constant input case (we can remove the buffer / scan nodes). Command line: ``` GOMAXPROCS=1 make bench PKG=./pkg/sql/opt/bench BENCHTIMEOUT=30m BENCHES='BenchmarkFKInsert/' TESTFLAGS='-logtostderr NONE -benchtime=20000x -count 5' ``` ``` name time/op FKInsert/SingleRow/None 609µs ± 4% FKInsert/SingleRow/Old 676µs ± 5% FKInsert/SingleRow/New 961µs ± 1% FKInsert/MultiRowSingleParent/None 1.37ms ± 1% FKInsert/MultiRowSingleParent/Old 2.14ms ± 1% FKInsert/MultiRowSingleParent/New 2.11ms ± 2% FKInsert/MultiRowMultiParent/None 1.62ms ± 2% FKInsert/MultiRowMultiParent/Old 2.89ms ± 1% FKInsert/MultiRowMultiParent/New 2.97ms ± 1% ``` Release note: None 39818: opt: nil presentation should not equal the 0-column presentation r=RaduBerinde a=RaduBerinde #### sql: enhance apply execbuilder error We have seen a series of bugs where the execbuilder hits an assertion error inside Apply. This change adds a detail to the error containing the formatted opt tree. Release note: None #### opt: nil presentation should not equal the 0-column presentation The nil presentation means that we want all columns in no particular order, whereas the 0-column presentation means that we don't need any of the columns (e.g. EXISTS subqueries). Only the nil presentation is `Any()`. But `Equals()` was incorrectly treating these as equal. This confused the interner and a nil presentation became a 0-column presentation which led to some internal errors in Apply. For completeness, we also fix `HashPhysProps` to differentiate between these two, but note that this isn't required for correctness. Fixes #39435. Release note (bug fix): Fixed internal errors generated during execution of some complicated cases of correlated subqueries. Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
Build succeeded |
sql: enhance apply execbuilder error
We have seen a series of bugs where the execbuilder hits an assertion
error inside Apply. This change adds a detail to the error containing
the formatted opt tree.
Release note: None
opt: nil presentation should not equal the 0-column presentation
The nil presentation means that we want all columns in no particular
order, whereas the 0-column presentation means that we don't need any
of the columns (e.g. EXISTS subqueries). Only the nil presentation
is
Any()
. ButEquals()
was incorrectly treating these as equal.This confused the interner and a nil presentation became a 0-column
presentation which led to some internal errors in Apply.
For completeness, we also fix
HashPhysProps
to differentiatebetween these two, but note that this isn't required for correctness.
Fixes #39435.
Release note (bug fix): Fixed internal errors generated during
execution of some complicated cases of correlated subqueries.