You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In PRQL, columns are arrays, not sets as they are in SQL. So columns do have an order they are in, which means that by default all aggregation function should take ordering into account.
So I think we could encode that in std.sql.prql with an annotation:
@{aggregation_unordered = true}
let sum = func col -> s"..."
@{aggregation_unordered = false}
let json_agg = func col -> s"..."
(intention: I want a single row that is a json array, which contains "month: total" entries, sorted by total)
I think this PRQL should produce the following SQL:
The important bit is that
json_agg
has its column ORDERed BY total.This is because
from invoices | sort total
produces a relation, ordered by total, so this ordering should be accounted by the aggregation function.The text was updated successfully, but these errors were encountered: