KuceraMartin / tyqu

Type-safe Queries
Apache License 2.0
50 stars 3 forks source link

group by #28

Closed KuceraMartin closed 1 year ago

KuceraMartin commented 1 year ago

GROUP BY requires mapping because we cannot do SELECT * FROM t GROUP BY ... -> introduce method groupMap(g: Scope => Tuple | Expression[?])(f: Scope => Tuple | Scope). The Scope in the second parameter list must be a special scope in which only the expressions return by g are directly available. Other expressions from the original scope should be somehow boxed such that they are not instances of Expression[?] but they have aggregation methods on them.

Question: how to let the user easily introduce new aggregation functions just by listing them at one place? Aggregations should always appear on

KuceraMartin commented 1 year ago

to compare whether two ColumnValues are the same, maybe we could add two more type parameters Relation.type and Column.type