-
Notifications
You must be signed in to change notification settings - Fork 279
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
[plan] support "GROUP BY 1" #17167
[plan] support "GROUP BY 1" #17167
Conversation
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Reviewer Guide 🔍
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Code Suggestions ✨
|
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.
test.
group by 1, 2
group by 1, 1
group by 0
group by -1
group by 1+1
group by 1.1
Some of them are invalid, some i dont know ...
also can 1, 2, 3 appear in having and order by?
@fengttt MySQL only support standalone literal positive integers. These are supported: These are not supported: I've verified it on MySQL both 5.7 and 8.0. ORDER BY is the same, and we've already supported it. HAVING doesn't support this feature, because HAVING is almost always followed by an expression (not a standalone literal). |
b6151af
to
3ab0520
Compare
Not supported: * GROUP BY '1' * GROUP BY 1 + 2 * HAVING 1 Approved by: @ouyuanning, @heni02
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #17150
What this PR does / why we need it:
Not supported:
PR Type
Enhancement, Tests
Description
GROUP BY
with integer constants in SQL queries.NewGroupBinder
to acceptselectList
and updatedBindExpr
to handle integer constants.buildSelect
function to use the newNewGroupBinder
signature.GroupBinder
struct with a newselectList
field.GROUP BY 1
syntax to validate the new functionality.Changes walkthrough 📝
group_binder.go
Add support for `GROUP BY` with integer constants
pkg/sql/plan/group_binder.go
GROUP BY
with integer constants.NewGroupBinder
to acceptselectList
.BindExpr
to handle integer constants inGROUP BY
.query_builder.go
Update `buildSelect` to support new `GroupBinder` signature
pkg/sql/plan/query_builder.go
buildSelect
to use the newNewGroupBinder
signature.types.go
Extend `GroupBinder` struct with `selectList` field
pkg/sql/plan/types.go
selectList
field toGroupBinder
struct.func_aggr_count.result
Update test cases to use `GROUP BY 1` syntax
test/distributed/cases/function/func_aggr_count.result
GROUP BY 1
syntax.func_aggr_count.test
Update test cases to use `GROUP BY 1` syntax
test/distributed/cases/function/func_aggr_count.test
GROUP BY 1
syntax.