-
Notifications
You must be signed in to change notification settings - Fork 75
Description
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.