You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lnav/src/prql/stats.prql

30 lines
690 B
Plaintext

let count_by = func column rel <relation> -> <relation> (
rel
group {column} (aggregate {total = count this})
sort {-total}
)
let average_of = func column rel <relation> -> <relation> (
rel
aggregate {value = average column}
)
let sum_of = func column rel <relation> -> <relation> (
(rel | aggregate {total = sum column})
)
let by = func column values rel <relation> -> <relation> (
rel
group {column} (aggregate values)
)
let hist = func column slice:'5m' rel <relation> -> (
rel
group { tslice = (time.slice log_time_msecs slice), column } (
aggregate { total = count(this) }
)
group { tslice } (
aggregate { v = json.group_object column total }
)
)