Repository navigation
Support GROUPS frame mode for window functions - #108653
Conversation
|
Workflow [PR], commit [a893d21] Summary: ✅
AI ReviewSummaryThis PR finishes user-facing Findings❌ Blockers
Final VerdictRequest changes. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 172/172 (100.00%) · Uncovered code |
| @@ -89,10 +84,6 @@ extractWindowDescriptions(const QueryTreeNodes & window_function_nodes, const Pl | |||
|
|
|||
| auto function_window_description = extractWindowDescriptionFromWindowNode(window_function_node, planner_context); | |||
There was a problem hiding this comment.
Making GROUPS reachable here also makes it a legitimate WindowStep payload in serialized query plans, but the plan protocol still has no way to distinguish peers that implement this frame type from peers that only speak query-plan serialization version 4.
serializeWindowFrame writes frame.type as a raw UInt8, deserializeWindowFrame accepts any value up to RANGE, and DBMS_QUERY_PLAN_SERIALIZATION_VERSION is still 4, so an older v4 peer will accept GROUPS at decode time even though its pre-PR executor still hits NOT_IMPLEMENTED when it reaches WindowTransform. That turns a protocol incompatibility into a late execution failure instead of failing closed up front.
Please bump the query-plan serialization version for this feature (or add an equivalent sender-side capability guard) before removing the planner-side rejection.
There was a problem hiding this comment.
Not a concern: WindowStep serialization is not in any release yet, and this lands in the same release, so no released peer can accept the step but lack GROUPS.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 119/119 (100.00%) · Uncovered code |
`master` moved the documentation from the Docusaurus tree under `docs/en/**/*.md` to the Mintlify tree at `docs/**/*.mdx`, deleting every file this branch edits. The edits are replayed at the new paths: - `docs/en/sql-reference/window-functions/dense_rank.md` -> `docs/reference/functions/window-functions/dense_rank.mdx` - `docs/en/sql-reference/window-functions/first_value.md` -> `docs/reference/functions/window-functions/first_value.mdx` - `docs/en/sql-reference/window-functions/lagInFrame.md` -> `docs/reference/functions/window-functions/lagInFrame.mdx` - `docs/en/sql-reference/window-functions/last_value.md` -> `docs/reference/functions/window-functions/last_value.mdx` - `docs/en/sql-reference/window-functions/leadInFrame.md` -> `docs/reference/functions/window-functions/leadInFrame.mdx` - `docs/en/sql-reference/window-functions/nonNegativeDerivative.md` -> `docs/reference/functions/window-functions/nonNegativeDerivative.mdx` - `docs/en/sql-reference/window-functions/nth_value.md` -> `docs/reference/functions/window-functions/nth_value.mdx` - `docs/en/sql-reference/window-functions/rank.md` -> `docs/reference/functions/window-functions/rank.mdx` - `docs/en/sql-reference/window-functions/row_number.md` -> `docs/reference/functions/window-functions/row_number.mdx` Accepted the deletion for pages the migration did not carry over: - `docs/en/sql-reference/window-functions/index.md` (no counterpart in the new tree)
# Conflicts: # docs/en/sql-reference/window-functions/dense_rank.md # docs/en/sql-reference/window-functions/first_value.md # docs/en/sql-reference/window-functions/index.md # docs/en/sql-reference/window-functions/lagInFrame.md # docs/en/sql-reference/window-functions/last_value.md # docs/en/sql-reference/window-functions/leadInFrame.md # docs/en/sql-reference/window-functions/nonNegativeDerivative.md # docs/en/sql-reference/window-functions/nth_value.md # docs/en/sql-reference/window-functions/rank.md # docs/en/sql-reference/window-functions/row_number.md
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes6 object files changed (-89.74 KiB total), 0 added.
737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units10 translation units recompiled, 39 s compile time in total, 10 of them have a recent master baseline. |
The query below applies the same
1 PRECEDING AND 1 FOLLOWINGbounds as aROWS, aRANGE, and aGROUPS(this PR) frame. Theordercolumn contains duplicate and non-consecutive values, so the three modes cover different rows:Each mode interprets the bounds differently:
ROWScounts physical rows, so the frame is at most three adjacent rows: the current row plus one on each side.RANGEcountsordervalues, so1 PRECEDINGand1 FOLLOWINGcover rows whoseorderis within 1 of the current row's. With gaps of 10, no neighbouring row qualifies, so the frame holds only the rows that share the currentorder.GROUPS(added by this PR) counts peer groups, so1 PRECEDINGand1 FOLLOWINGalways include the adjacent groups in full, whatever the gaps betweenordervalues.cc: @cwurm
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Support the
GROUPSframe mode for window functions (SQL:2011), e.g.any(price) OVER (PARTITION BY symbol ORDER BY ts GROUPS BETWEEN CURRENT ROW AND 1 FOLLOWING). In aGROUPSframe the boundaries count whole peer groups — sets of rows that are equal on theORDER BYkey — soN PRECEDING/N FOLLOWINGmeanNpeer groups before/after the current row's peer group, rather than physical rows (ROWS) orORDER BYvalue distances (RANGE).Version info
26.8.1.1354(included in26.8and later)