otter-sql icon indicating copy to clipboard operation
otter-sql copied to clipboard

`GROUP BY` support

Open Samyak2 opened this issue 2 years ago • 0 comments

Overview

This is a tracking issue for adding support for the GROUP BY clause of a SELECT statement. This allows aggregations over unique values of a column.

Tasks

  • [x] add instructions for GROUP BY and aggregations
    • See the GroupBy instruction
    • Aggregations are defined in the expr for Project or Filter just like normal non-grouped aggregations
    • Note: this is most likely subject to change
  • [x] add GROUP BY codegen to the generic dialect
  • [ ] evaluating GroupBy instructions and aggregations
    • from #16, we saw that
      • GroupBy should probably have input and output registers like Project
      • we need a different table with an efficient index implementation to look up the grouped columns
      • the HAVING clause can re-use aggregations that are already computed and it might be difficult to perform common sub-expression elimination here

Samyak2 avatar Jan 24 '23 14:01 Samyak2