name: op-win-dense-rank
description: Dense rank with no gaps after ties (1, 2, 2, 3, ...) within the ordered partition.
kind: operator
category: WIN
operator: WIN_DENSE_RANK
type: reference
applies_to: process, compose, predict
examples_tags: [cohort-analysis, top-n, window-operator, buffered-pipeline]
Window operators emit row-level values; they do not produce Response.Components.
Use when
Ranks rows within each partition in the chosen order; rows with equal values share a rank and the next follows on: 1, 2, 2, 3.
Questions it answers:
- Which price tier is each product in, counting equal prices as one tier?
- With scores ordered desc, how many distinct scores sit above each respondent’s (the dense rank minus 1)?
Use something else:
WIN_RANKwhen the rank should skip past equal values, as in sports standings.
Params
None. partition_by (carve), order_by (≥1, required, any type but set_* (PULSE_WINDOW_INVALID) or vec_* (PULSE_VECTOR_FIELD_NOT_SCALAR) — tie comparison reads these keys), frame (forbidden), field (refused PULSE_WINDOW_INVALID — no value read; manifest forbids_field, accepts_types: []).
Inputs
field— must be empty / omitted — reads ranking fromorder_bykeys only
Output
One integer per row written to label (default WIN_DENSE_RANK). Ties share a rank; next distinct row advances by exactly 1 — (1, 2, 2, 3, 4). Rank resets per partition.
Reading the output
value: The row’s position among the distinct order_by values within its partition, starting at 1. Rows equal on every order_by key share a rank, and the next rank follows on with no gap: 1, 2, 2, 3. The largest rank is the number of distinct values, not the number of rows.- Caveat: Rank 1 is the first row in order_by order: the smallest value with an ascending key, the largest with desc. Say which when reporting a ‘top’ rank.
Contract
- Types: reads no field; naming one is
PULSE_WINDOW_INVALID. - Weight: no weighted form and no slot weight; a request weight is
PROCESSING_CONFIG, an instance default is skipped. - Streaming: buffered only.
Gotchas
- Tie comparison uses every
order_bykey; tie only when ALL keys equal. - The last rank counts distinct keys, not rows.
- Result rows are NOT reordered — use
sortfor response order.
See
pulse_examples_search tags=[top-n]- Skills:
window-design,op-win-rank,op-win-row-number