Window function post-processing engine.
Operates on query result rows (vectors of values) after the main Datalog query has executed. Computes ROW_NUMBER, RANK, DENSE_RANK, NTILE, PERCENT_RANK, CUME_DIST, running SUM/AVG/COUNT/MIN/MAX, and LAG/LEAD.
Architecture: matches Stratum's window.clj interface (same spec maps) but uses row-based processing instead of columnar typed arrays.
Window spec format: {:op :row-number/:rank/:dense-rank/:ntile/:sum/:avg/:count/:min/:max/:lag/:lead :col-idx int — column index for aggregate/offset ops (nil for ranking) :partition-by [idx ...] — column indices for partitioning :order-by [[idx :asc/:desc] ...] — column indices + direction for sorting :frame {:type :rows/:range :start bound :end bound} :offset int — LAG/LEAD offset (default 1) :default val — LAG/LEAD default value :ntile-n int} — NTILE bucket count
Window function post-processing engine.
Operates on query result rows (vectors of values) after the main Datalog
query has executed. Computes ROW_NUMBER, RANK, DENSE_RANK, NTILE,
PERCENT_RANK, CUME_DIST, running SUM/AVG/COUNT/MIN/MAX, and LAG/LEAD.
Architecture: matches Stratum's window.clj interface (same spec maps)
but uses row-based processing instead of columnar typed arrays.
Window spec format:
{:op :row-number/:rank/:dense-rank/:ntile/:sum/:avg/:count/:min/:max/:lag/:lead
:col-idx int — column index for aggregate/offset ops (nil for ranking)
:partition-by [idx ...] — column indices for partitioning
:order-by [[idx :asc/:desc] ...] — column indices + direction for sorting
:frame {:type :rows/:range :start bound :end bound}
:offset int — LAG/LEAD offset (default 1)
:default val — LAG/LEAD default value
:ntile-n int} — NTILE bucket count(execute-window-functions rows window-specs)Apply window function specs to query result rows. rows: seq of result tuples (vectors) window-specs: [{:op :row-number :partition-by [idx] :order-by [[idx :dir]] :frame {...} ...}] Returns rows with window values appended to each tuple.
Apply window function specs to query result rows.
rows: seq of result tuples (vectors)
window-specs: [{:op :row-number :partition-by [idx] :order-by [[idx :dir]] :frame {...} ...}]
Returns rows with window values appended to each tuple.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |