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
run: something -> {
group_by: thing
aggregate: stuff
order_by: stuff
nest: cool_chart
calculate: n is row_number()
}
We generate SQL like:
WITH __stage0 AS (
SELECT
group_set,
... as"stuff__0"
... row_number() ... as"n__0"FROM (...)
GROUP BY ...
)
SELECT
... as"stuff",
... as"n"FROM __stage0
GROUP BY1ORDER BY"stuff"desc
If there is a tie between rows A and B in the stuff field, the row_number() can be calculated with A before B in __stage0, then ordered with B before A in the outer select. This results in something like:
thing: "C" stuff: 100, cool_chart: ..., n: 1
thing: "D" stuff: 90, cool_chart: ..., n: 2
thing: "B" stuff: 80, cool_chart: ..., n: 4
thing: "A" stuff: 70, cool_chart: ..., n: 3
This does not happen without a nest in the query because it only generates a one-stage query.
The text was updated successfully, but these errors were encountered:
In a query like:
We generate SQL like:
If there is a tie between rows A and B in the
stuff
field, therow_number()
can be calculated with A before B in__stage0
, then ordered with B before A in the outer select. This results in something like:This does not happen without a
nest
in the query because it only generates a one-stage query.The text was updated successfully, but these errors were encountered: