DaphneIR has a GroupOp for relational-style grouping and aggregation, plus a corresponding group-kernel. However, at the moment, this operation can only be created through DAPHNE's SQL parser, but not through DaphneDSL.
This task is to add a group() built-in function to DaphneDSL that creates a GroupOp in DaphneIR. The interface should be (following the notation used in the docs: group(arg:frame, groupCols:str, ..., sumCol:str). That is, the built-in function gets a frame, an arbitrary number of columns to group on, and a single column to calculate the sum on. While this interface does not allow to use all features of the GroupOp/group-kernel (e.g., multiple aggregates, other aggregate functions than sum), it would be a good first step and sufficient for implementing the Star Schema Benchmark in DaphneDSL. We can reflect the full functionality of the GroupOp is DaphneDSL later.
Hints:
Add the new built-in function in the DaphneDSL parser.
Add a few script-level test cases for the group built-in function.
group is a variadic built-in/op/kernel. See existing ops like createFrame for an example. E.g., have a look at how they are handled in src/parser/daphnedsl/DaphneDSLBuiltins.cpp.
For an example of how to create a GroupOp, see the SQL parser in src/parser/sql/SQLVisitor.cpp.
DaphneIR has a
GroupOp
for relational-style grouping and aggregation, plus a correspondinggroup
-kernel. However, at the moment, this operation can only be created through DAPHNE's SQL parser, but not through DaphneDSL.This task is to add a
group()
built-in function to DaphneDSL that creates aGroupOp
in DaphneIR. The interface should be (following the notation used in the docs:group(arg:frame, groupCols:str, ..., sumCol:str)
. That is, the built-in function gets a frame, an arbitrary number of columns to group on, and a single column to calculate the sum on. While this interface does not allow to use all features of theGroupOp
/group
-kernel (e.g., multiple aggregates, other aggregate functions than sum), it would be a good first step and sufficient for implementing the Star Schema Benchmark in DaphneDSL. We can reflect the full functionality of theGroupOp
is DaphneDSL later.Hints:
group
built-in function.group
is a variadic built-in/op/kernel. See existing ops likecreateFrame
for an example. E.g., have a look at how they are handled insrc/parser/daphnedsl/DaphneDSLBuiltins.cpp
.GroupOp
, see the SQL parser insrc/parser/sql/SQLVisitor.cpp
.