Skip to content
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

Support GROUP BY ALL #15946

Open
proddata opened this issue May 2, 2024 · 6 comments
Open

Support GROUP BY ALL #15946

proddata opened this issue May 2, 2024 · 6 comments
Assignees
Labels
feature: sql: group by feature: ux leverage: low How well this feature composes and how many use-cases it opens up

Comments

@proddata
Copy link
Member

proddata commented May 2, 2024

Problem Statement

When interactively writing queries in CrateDB one needs to specify the list of columns in two locations for aggregations, which can lead to broken queries and pontential bugs.

SELECT
  col1,
  agg(col2),
  col3
FROM t01;
GROUP BY
  col1, col3;

Possible Solutions

To prevent broken queries and pontential bugs by keeping the SELECT granularity aligned to the GROUP BY granularity one could either add support for GROUP BY ALL similiar to Snowflake, DuckDB, ClickHouse and others

SELECT
  col1,
  agg(col2),
  col3
FROM t01;
GROUP BY ALL;

ALL is already a reserved keyword - this wouldn't be a breaking change.

Considered Alternatives

No response

@mfussenegger mfussenegger added feature: ux feature: sql: group by leverage: low How well this feature composes and how many use-cases it opens up labels May 6, 2024
@mfussenegger
Copy link
Member

Referencing the columns by ordinal is an alternative - although a bit less convenient:

SELECT
  col1,
  agg(col2),
  col3
FROM t01;
GROUP BY
  1, 3;

@proddata

This comment was marked as resolved.

@DHRUV6029
Copy link
Contributor

Hi, Can i Work on this feature

@matriv
Copy link
Contributor

matriv commented May 17, 2024

@DHRUV6029 Thx for volunteering to work on this!
Please let us know of any help you might need.

@DHRUV6029
Copy link
Contributor

Hello , Thanks for assigning me the task.
I had few queries @mfussenegger mentioned do we need ordinal number refrence or, we just want to support Group by ALL
clause

Thanks

@proddata
Copy link
Member Author

@DHRUV6029 Just GROUP BY ALL. Ordinal number references are already implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: sql: group by feature: ux leverage: low How well this feature composes and how many use-cases it opens up
Projects
None yet
Development

No branches or pull requests

4 participants