-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat: add support for WITH ROLLUP #15930
Conversation
Signed-off-by: Andres Taylor <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
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.
Just one nit, the rest looks good to me but let's see what @GuptaManan100 says about the shit/reduce introduced. Approving this for now 🚀
@@ -42,11 +42,11 @@ func isMergeable(ctx *plancontext.PlanningContext, query sqlparser.SelectStateme | |||
|
|||
switch node := query.(type) { | |||
case *sqlparser.Select: | |||
if len(node.GroupBy) > 0 { | |||
if node.GroupBy != nil && len(node.GroupBy.Exprs) > 0 { |
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.
Since we are setting group by to nil
everytime we empty it, it should be fine to just check for node.GroupBy != nil
.
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
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.
I looked at the sql.y changes, and although it is possible to get rid of the shift-reduce conflict, it is going to make the code a little less readable. I think its okay to leave the conflict since they resolve to shifting.
Signed-off-by: Andres Taylor <[email protected]>
@@ -375,7 +376,7 @@ func markBindVariable(yylex yyLexer, bvar string) { | |||
%token <str> ST_Area ST_Centroid ST_ExteriorRing ST_InteriorRingN ST_NumInteriorRings ST_NumGeometries ST_GeometryN ST_LongFromGeoHash ST_PointFromGeoHash ST_LatFromGeoHash ST_GeoHash ST_AsGeoJSON ST_GeomFromGeoJSON | |||
|
|||
// Match | |||
%token <str> MATCH AGAINST BOOLEAN LANGUAGE WITH QUERY EXPANSION WITHOUT VALIDATION | |||
%token <str> MATCH AGAINST BOOLEAN LANGUAGE WITH QUERY EXPANSION WITHOUT VALIDATION ROLLUP |
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.
ROLLUP needs to be added to the list of non-reserved
keywords list in the end of the file.
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15930 +/- ##
==========================================
- Coverage 68.45% 68.45% -0.01%
==========================================
Files 1559 1559
Lines 196825 196872 +47
==========================================
+ Hits 134736 134764 +28
- Misses 62089 62108 +19 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Description
Adds parser support for
GROUP BY... WITH ROLLUP
. Before this, Vitess did not supportWITH ROLLUP
.This PR only adds parser support - queries using
WITH ROLLUP
on unsharded keyspaces will be able to use these queries. If the query needs to be split across multiple shards,vtgate
will fail with an unsupported error.Related Issue(s)
Fixes #7476
Checklist