chdb-io / chdb

chDB is an in-process OLAP SQL Engine 🚀 powered by ClickHouse
https://clickhouse.com/docs/en/chdb
Apache License 2.0
2.03k stars 72 forks source link

Aggregate function bindings #51

Open danthegoodman1 opened 1 year ago

danthegoodman1 commented 1 year ago

Very similar to the function bindings, but can be used as an aggregate function. For example a query could be:

select myfunc(colA), colB from t group by colB

Where:

def myfunc(prev: int | None, row: int) -> int:
  return 2*row + prev if prev != None else 0

(don't even know if that's valid python just a random example)

prev being an accumulator, and row being the current row