-
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
sql: fix and enhance expression normalization. #7512
Conversation
Reviewed 2 of 4 files at r1, 2 of 2 files at r2. sql/parser/col_types.go, line 275 [r2] (raw file):
log the type sql/parser/normalize.go, line 611 [r2] (raw file):
i don't think that's what it does... sql/parser/normalize.go, line 654 [r2] (raw file):
log the type Comments from Reviewable |
Review status: 0 of 4 files reviewed at latest revision, 3 unresolved discussions, some commit checks pending. sql/parser/col_types.go, line 275 [r2] (raw file):
|
Reviewed 4 of 4 files at r3. sql/parser/col_types.go, line 275 [r2] (raw file):
|
Review status: 2 of 5 files reviewed at latest revision, 3 unresolved discussions, some commit checks pending. sql/parser/col_types.go, line 275 [r2] (raw file):
|
Review status: 2 of 5 files reviewed at latest revision, 4 unresolved discussions, some commit checks pending. sql/parser/normalize.go, line 715 [r5] (raw file):
@tamird hmm are you ok with having to explicitly write "return" after a call to log.Fatalf? Can we inform the compiler this does not return? Comments from Reviewable |
Reviewed 3 of 3 files at r5. sql/parser/normalize.go, line 676 [r5] (raw file):
oh good god. how about an error return? sql/parser/normalize.go, line 715 [r5] (raw file):
|
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed. sql/parser/normalize.go, line 676 [r5] (raw file):
|
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed. sql/parser/normalize.go, line 715 [r5] (raw file):
|
Review status: 3 of 5 files reviewed at latest revision, 2 unresolved discussions. sql/parser/normalize.go, line 676 [r5] (raw file):
|
Reviewed 2 of 2 files at r6. sql/parser/normalize.go, line 705 [r6] (raw file):
what is Comments from Reviewable |
Review status: 4 of 5 files reviewed at latest revision, 1 unresolved discussion, some commit checks pending. sql/parser/normalize.go, line 705 [r6] (raw file):
|
Reviewed 1 of 1 files at r7. sql/parser/normalize.go, line 705 [r6] (raw file):
|
Do you mind running a SQL benchmark diff over this change, just to make sure there weren't any exceptionally inefficient normalization steps introduced. Reviewed 1 of 2 files at r6, 4 of 4 files at r8. sql/parser/col_types.go, line 259 [r8] (raw file):
Don't we already have all of these defined (see sql/parser/expr.go, line 994 [r8] (raw file):
sql/parser/expr.go, line 995 [r8] (raw file):
sql/parser/expr.go, line 1006 [r8] (raw file):
nit: We usually use the sql/parser/normalize.go, line 34 [r8] (raw file):
I like this normalization, but it's a bit more involved than the others. It could use a short comment. sql/parser/normalize.go, line 37 [r8] (raw file):
nit: Something like sql/parser/normalize.go, line 67 [r8] (raw file):
Doesn't sql/parser/normalize.go, line 95 [r8] (raw file):
Double checking: This property is true of all data types, right? sql/parser/normalize.go, line 162 [r8] (raw file):
We don't need sql/parser/normalize.go, line 228 [r8] (raw file):
same as above, isn't sql/parser/normalize.go, line 489 [r8] (raw file):
I was recently thinking about this. Does the walk infrastructure/normalizeVisitor take care of recursing into modified returned expressions? sql/parser/normalize.go, line 621 [r8] (raw file):
If this is a common case, then allocating a new error every time is going to be an issue. sql/parser/normalize.go, line 728 [r8] (raw file):
Can this be added to the type switch? sql/parser/type_check.go, line 58 [r8] (raw file):
nit: This doesn't seem to fit our naming convention for "annotation methods". It should probably just be sql/parser/type_check.go, line 61 [r8] (raw file):
Can these be changed to Comments from Reviewable |
Running the benchmarks now. Will post the results later. Review status: 1 of 5 files reviewed at latest revision, 15 unresolved discussions, some commit checks pending. sql/parser/col_types.go, line 259 [r8] (raw file):
|
Review status: 1 of 5 files reviewed at latest revision, 15 unresolved discussions, some commit checks pending. sql/parser/type_check.go, line 61 [r8] (raw file):
|
So the only benchmark that has expressions which would test something related are Select2 and Select3. This is what I measure:
|
Review status: 1 of 5 files reviewed at latest revision, 4 unresolved discussions, all commit checks successful. sql/parser/expr.go, line 996 [r10] (raw file):
sql/parser/normalize.go, line 728 [r8] (raw file):
|
Review status: 1 of 5 files reviewed at latest revision, 4 unresolved discussions, all commit checks successful. sql/parser/expr.go, line 996 [r10] (raw file):
|
Review status: 1 of 5 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. sql/parser/normalize.go, line 728 [r8] (raw file):
|
This patch is needed so that the expressions in the Sqllogictest do not cause the server to panic. Summary: - Bug fixes: - an invalid cast was attempted for some expressions; is now fixed. - NULL caused invalid transformations, NULL is now normalized on a fast path. - transformations that rebalance arithmetic across a comparison now first check that the proposed replacement arithmetic expression has a valid overload w.r.t typing. - Improvements: more simplifications.
Review status: 0 of 5 files reviewed at latest revision, 2 unresolved discussions, some commit checks pending. sql/parser/normalize.go, line 728 [r8] (raw file):
|
LGerTM Reviewed 1 of 1 files at r10, 3 of 3 files at r12. Comments from Reviewable |
This patch is needed so that the expressions in the Sqllogictest do
not cause the server to panic.
Summary:
fast path.
first check that the proposed replacement arithmetic expression
has a valid overload w.r.t typing.
Fixes #7412.
This change is