Include on clauses in impossible queries, to avoid only_full_group_by in aggregations with joins#2433
Merged
sougou merged 2 commits intovitessio:masterfrom Jan 4, 2017
Merged
Conversation
… in aggregations with joins
a7b381c to
793d493
Compare
Contributor
Author
|
I missed a couple of tests in the endtoend package. Working on those now, but I don't anticipate much issue aside from updating them to use the new format |
sougou
reviewed
Jan 4, 2017
go/vt/sqlparser/impossible_query.go
Outdated
| case *JoinTableExpr: | ||
| if node.Join == LeftJoinStr || node.Join == RightJoinStr { | ||
| node.Format(buf) | ||
| if node.On == nil && (node.Join == LeftJoinStr || node.Join == RightJoinStr) { |
Contributor
There was a problem hiding this comment.
The nil check is not required, because the parser rules enforce it.
Contributor
There was a problem hiding this comment.
In other words, I think you can remove this entire case.
Contributor
Author
There was a problem hiding this comment.
Yea, I just realized that :) Simplifying now
Contributor
Author
|
End to end tests fixed, and removed the explicit handling of |
Contributor
dispalt
added a commit
to dispalt/vitess
that referenced
this pull request
Jan 9, 2017
* 'master' of https://github.com/youtube/vitess: (220 commits) vtgate/vindexes: Do not run testfiles.Locate() from init() (2nd time). Add comment to document when new fields are included in response publish site Fri Jan 6 08:02:30 PST 2017 Updating doc. Optionally send additional C API fields through in responses Fixing explorer to handle empty files. MultiRow Insert Optimization (vitessio#2422) Now the local examples use 'zk2' topology. Adding Consul 0.7.2 to base docker image. etcd2topo: using lease ID in lock filenames. Implementing the Consul topology client. test: vtgate_buffer.py: Add second test for vtctl TabletExternallyReparented. test: vtgate_buffer.py: Stop the the two threads in case of a test error. test: vtgate_buffer.py: Move setup code from setUp to setUpModule. test: Add "demote_master_commands" to MysqlFlavor class. Include on clauses in impossible queries, to avoid only_full_group_by in aggregations with joins (vitessio#2433) Adds support for parsing queries with boolean value comparisons, i.e. true/false and =, !=, >, <, >=, <= (vitessio#2432) V3 Engine Code Refactor (vitessio#2423) Refactor impossible query generation, and support group by - (vitessio#2409) docker/test/run: Avoid using non-universal --tmpdir flag on mktemp (vitessio#2429) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have some queries which have aggregations as well as a join, and the existing impossible query was causing
only_full_group_byerrors in MySQL. Here's an example query:The t.id needs to either be joined on, or added to the group by. In this case it makes sense to be joined on.
This PR adds the On clause when it exists, and falls back to
1 != 1when it does not, for left and right joins. Updated all tests to account for new formatting.I verified with EXPLAIN that the new queries still result in
Impossible WHEREand so should be just as fast, but safer.cc @sougou