sixthnormal / clj-3df

Clojure(Script) client for Declarative Dataflow.
Eclipse Public License 2.0
328 stars 13 forks source link

Multiple aggregations #15

Closed bachdavi closed 5 years ago

bachdavi commented 5 years ago

Currently we nest multiple aggregations in the same :find-clause. This leads to problems in the backend, as already aggregated results are input-collections to the higher aggregations operators.

comnik commented 5 years ago

Interesting! Yeah we'll have to think about maybe extending Aggregate to support multiple different aggregations on the same relation? Because both semantics can be useful at times (maybe not for Datalog, but in general).

bachdavi commented 5 years ago

An example would be:

:find ?team (count ?score) (avg ?score) (median ?score)
...

I think datomic implements it.

comnik commented 5 years ago

Quoting myself:

We can look at something like (->Aggregation [fn vars ...] [fn vars ...] ...+). Should also allow for the most efficient implementations (e.g. re-use the same grouping and compute multiple aggregates per group).