Remove hard-coded aggregations within the AST
alancai98 opened this issue · 2 comments
There are several places within the partiql-parser and partiql-ast where we specify dedicated aggregation rules and nodes.
In the ANTLR grammar:
partiql-lang-kotlin/partiql-parser/src/main/antlr/PartiQL.g4
Lines 727 to 730 in 2879f3a
A couple problems w/ above:
- Aggregate function names are hard-coded
- Designated
aggregate
rule -- perhaps can be consolidated with the existing function call rule
In the partiql-ast:
partiql-lang-kotlin/partiql-ast/src/main/resources/partiql_ast.ion
Lines 351 to 356 in 2879f3a
Similar issue to above.
To allow for aggregate UDFs in the future, we should not distinguish between the aggregate and scalar functions till planning time. This will require modification of the AST to plan conversion code, which currently assumes the resolution occurs during parsing.
This task can be broken down into multiple components:
- removing hard-coded aggregate functions from AST + parser
- figuring out scalar vs aggregation resolution in the planner. As a temporary workaround, could hard-code the logic in the AST to plan code. A future PR could integrate this resolution w/ the SPI + connector metadata interfaces.
- (future) creating a UDF aggregation function -- might require further specification. E.g. name conflicts between scalar and aggregate functions.