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

Allow simple GROUP BY clauses #140

Open
cswinter opened this issue Feb 23, 2021 · 0 comments
Open

Allow simple GROUP BY clauses #140

cswinter opened this issue Feb 23, 2021 · 0 comments

Comments

@cswinter
Copy link
Owner

LocustDB currently doesn't support explicit GROUP BY clauses, and instead implicitly performs GROUP BY of any non-aggregation expression if your query contains an aggregation expression. So e.g. SELECT COUNT(1), page, date FROM pageviews is implicitly transformed into SELECT COUNT(1), page, date FROM pageviews GROUP BY page, date. There's no fundamental reason for this other than that it seemed more elegant and I didn't want to type redundant GROUP BY clauses. I think it would be a good idea to allow normal GROUP BY clauses and perhaps even disallow the (non-standard) shorthand. The hard part here is checking that the GROUP BY clause is compatible with the projections and different databases seem to vary in the level of cleverness supported for this. As a first step, LocustDB should support GROUP BY clauses expressions where corresponding SELECT expressions are completely identical.
A more expressive version would also allow projections to be functions of the GROUP BY columns, e.g. queries like SELECT COUNT(1), page, SUBSTRING(date, 0, 4) FROM pageviews GROUP BY page, date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant