Skip to content

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

Open
jovfer wants to merge 1 commit intomainfrom
sm_ntile_cumedist_nthvalue
Open

Add docs for ntile, cume_dist, and nth_value window functions#430
jovfer wants to merge 1 commit intomainfrom
sm_ntile_cumedist_nthvalue

Conversation

@jovfer
Copy link
Copy Markdown
Contributor

@jovfer jovfer commented May 6, 2026

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. Currently double-only; LONG / TIMESTAMP overloads are tracked in feat(sql): add nth_value support for LONG and TIMESTAMP arguments questdb#7037.

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 and replaced it with a note about nth_value being double-only for now.

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
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

🚀 Build success!

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

Commit SHA: 645ee48

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

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.

1 participant