Repository navigation
Introduce General Window Functions Batch Execution - #127389
Conversation
|
Workflow [PR], commit [1ac6d9a] Summary: ❌
AI ReviewSummaryThe PR separates general window functions from aggregates and evaluates them in batches. At head Findings❌ Blockers
Missing context / blind spots
Final Verdict❌ Block — The two dismissed concerns remain present in the current code. The minimum technical changes are incremental/reused argument indexing and cancellation checks during expensive evaluation, with focused scaling and cancellation validation. Existing dismissed threads were left unchanged; no new review batch was necessary. |
Build profile diff (arm_release)Comparing commit See the job log for details. |
yariks5s
left a comment
There was a problem hiding this comment.
Regarding the bot's performance findings, I think that's still a reasonable trade-off given the code complexity. At least now
@groeneai please validate whether these findings existed before, and create a separate issue and a fix for them.
|
I checked both performance findings against master. Neither existed before; both come from the batch path in this PR.
Issue: #127659. I'll send the fix after this PR is merged, since both are in the new code. |
Co-authored-by: Yarik Briukhovetskyi <[email protected]>
Co-authored-by: Yarik Briukhovetskyi <[email protected]>
Co-authored-by: Yarik Briukhovetskyi <[email protected]>
Co-authored-by: Yarik Briukhovetskyi <[email protected]>
…es without rabbitmqctl `rabbitmqctl close_all_connections test` timed out after 300 s in 3 runs of `Integration tests (arm_binary, 2/4)` (master 524a0c2, ClickHouse#127389, ClickHouse#126642). The close never reached the broker: no `Closing connection ... because "test"` line in its log, and ClickHouse's AMQP connection stayed open for 5 minutes until the test dropped the database. The broker passed its `rabbitmq-diagnostics ping` healthcheck 29/29 times in each window, so a new CLI process again never got to its RPC, like the `list_queues` call before. Bounding the call and asking again does not fit here: the drop must happen while most of the backlog is still queued (`view_rows() < messages_num // 2`), which leaves about 9 s after the 500-row trigger at ~490 rows/s, and a timed-out `docker exec` leaves the CLI running in the container, where a late close would force a second reconnect. Close through the management API instead: `DELETE /api/connections/username/root` with `X-Reason: test` reaches the same `rabbit_networking:close_connection(Pid, "test")` for every connection of the broker's only user, synchronously before the 204 reply, and starts no CLI process. Validated: an injected never-returning close fails the unfixed test after 300 s with the CI error; without the DELETE the test fails waiting for the reconnect; the pre-ClickHouse#125105 binary still fails on the duplicates bound (9500, 9400); 50/50 runs pass with `204` (p50 0.1 s) and ClickHouse logs `CONNECTION_FORCED - test` then `Connection restored`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Follow-up to #127389 (comment): the fix for the retained-block walk (#127659) is #128097. It keeps one argument block index per transform instead of rebuilding it every batch ( |
…-rank-dense-rank-rows-frame-peers Master's ClickHouse#125749 (Peers) and ClickHouse#127389 (general window functions batch execution) removed IWindowFunction.h and made rank() and dense_rank() read bounds.peers_start and bounds.peer_group_index. Port of the same fix onto that interface: - needsSeparateOrderByPeerGroups uses the function's getRequirements().peers (under ROWS only rank() and dense_rank() can require peers, cume_dist() and percent_rank() reject any frame but RANGE over the whole partition), so the needsOrderByPeerGroup virtual is dropped. - The ORDER BY peer group start is tracked in WindowTransform as before and appendCurrentRow passes it as peers_start / peer_group_index, so the rank and dense_rank sources are master's again. - SlidingIndexes is unchanged on master and merged cleanly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Follow-up to #127389 (comment), where I left cancellation inside a batch as is: it now hangs master CI. SELECT ... exponentialTimeDecayedMax(100)(x, t) OVER w ... FROM numbers(1000000)
WINDOW w AS (ORDER BY 1 DESC GROUPS BETWEEN 2 PRECEDING AND 2 FOLLOWING)
Wall time with
Both binaries report @Michicosun which do you prefer: (a) I open a PR that passes the cancellation flag into |
|
@groeneai, I explicitly told you that this is not a problem. |
|
Understood, sorry for raising it again. I will not open a PR for this. |
… right key twice `buildJoinUsingCondition` casts the right `USING` column to the common type as an alias with the input's own name, and `join_use_nulls` wraps it in `toNullable`, so the right after-join action is `ALIAS k -> toNullable -> ALIAS k -> _CAST -> INPUT k`. For a prepared storage, `buildPhysicalJoinImpl` replaced that action with `children(0)->children(0)`, assuming `toNullable` reads the input. With a promoted column this is the already cast alias, so the right pre-join DAG outputs `k` cast to the common type. For a key-value storage the whole after-join chain is then merged into the same DAG, and `ActionsDAG::mergeInplace` binds the chain's input `k` by name to that cast alias. The second `_CAST` was prepared for a `LowCardinality` argument and gets a plain column: `Bad cast ... to DB::ColumnLowCardinality` (abort in debug). When the key needs no cast (`String` x `LowCardinality(String)`), the DAG outputs the raw key and the promoted alias, the merge binds the raw one, and two `k` columns of different types remain: `Block structure mismatch`. For a key-value storage, pass only the inputs of such an action, since the whole action is merged into the DAG right after; the chain then runs once over the stored column. The `Join` engine path does no merge and is unchanged. Found by the AST fuzzer (STID 4525-5f05) on PR ClickHouse#127389. Released 26.3 and 26.8 reject `String` x `LowCardinality(String)` with `Code: 49`; 25.8 returns the right rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
This patch changes how
WindowTransformexecutes window functions by introducing batched execution over sliding blocks. Also, a general window function interface will be introduced in this patch.Workflow [PR]
Sync PR [sync-upstream/pr/127389]
Version info
26.11.1.875-master(included in26.11and later)