Skip to content

Add docs for ntile, cume_dist, and nth_value window functions - #430

Merged
javier merged 8 commits into
mainfrom
sm_ntile_cumedist_nthvalue
May 15, 2026
Merged

Add docs for ntile, cume_dist, and nth_value window functions#430
javier merged 8 commits into
mainfrom
sm_ntile_cumedist_nthvalue

Conversation

@jovfer

@jovfer jovfer commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Documents the three new window functions added in questdb/questdb#6925:

  • ntile(n) — distributes rows of an ordered partition into n approximately equal buckets and returns the 1-based bucket number.
  • cume_dist() — returns the cumulative distribution of the current row (including peers) within the partition.
  • nth_value(value, n) — returns the n-th value (1-based) within the current window frame, or NULL when the frame is smaller than n. Accepts double, long, and timestamp values.

Each section calls out the actual rules from the PR — n must be a constant, framing is rejected for ntile / cume_dist, nth_value rejects IGNORE NULLS / RESPECT NULLS / FROM FIRST / FROM LAST, etc. Tabular examples mirror the test data in WindowFunctionTest.

Also:

  • Updated the overview quick-reference table with the three functions.
  • Updated the ranking-functions section header (these new ranking-style functions don't all return ranks, so the header now says "ranks, row numbers, or partition-scoped distribution values").
  • Removed the obsolete "ntile() and cume_dist() are not currently supported" line from the bottom Notes.

Test plan

  • yarn build succeeds
  • Visual review of query/functions/window-functions/overview.md and query/functions/window-functions/reference.md
  • Anchor links #nth_value, #cume_dist, #ntile resolve from the overview quick-reference table

🤖 Generated with Claude Code

Document the three new window functions added in questdb/questdb#6925.
Cover argument and frame rules, edge cases, error conditions, and tabular
examples mirroring the PR's test data. Update the overview quick reference
and remove the stale "not currently supported" note from the reference.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown

🚀 Build success!

Latest successful preview: https://preview-430--questdb-documentation.netlify.app/docs/

Commit SHA: 0abfaa6

📦 Build generates a preview & updates link on each commit.

javier added 2 commits May 8, 2026 17:27
- Remove epoch-era timestamps from synthetic examples, use current dates
- Replace [$today] bracket syntax with $today across all queries
- Improve cume_dist demo query with single-symbol filter and DESC ordering
- Clarify nth_value relationship to lag (frame-relative vs row-relative)
- Remove unsupported FROM FIRST/FROM LAST mentions from nth_value
- Remove internal implementation notes about type overloads
- Use abbreviated ROWS N PRECEDING frame syntax
- Fix em dash and dash-separator style across the file
javier
javier previously approved these changes May 8, 2026
jovfer and others added 2 commits May 15, 2026 10:53
Align the argument/return wording with other reference-style window
functions (lag/lead/first_value/last_value) now that nth_value accepts
all three supported types instead of only double.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@javier
javier merged commit 4b0d7b9 into main May 15, 2026
7 checks passed
@javier
javier deleted the sm_ntile_cumedist_nthvalue branch May 15, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants