Repository navigation
Avoid unnecessary cuts for ArrayJoin - #124727
Conversation
…zy-passengers-without-cut # Conflicts: # src/Interpreters/ArrayJoinAction.cpp # tests/performance/array_join.xml
|
Workflow [PR], commit [7b7701d] Summary: ✅
AI ReviewSummaryThis PR changes PR Metadata
Missing context / blind spots
Final Verdict✅ Looks good to merge from a correctness/code-review perspective once the changelog metadata is updated; I did not find any remaining inline code issues to post. |
…replicated column
Build profile diff (arm_release)Commit See the job log for details. |
…zy-passengers-without-cut
|
@yariks5s @nihalzp — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
Since ClickHouse#124727 every lazily replicated ARRAY JOIN passenger wrapped the whole uncut input-block column, with indexes into the current window. All output blocks of one input block then shared that column, and every ColumnReplicated consumer treats the nested column as the block's own data: byteSize (Chunk::bytes, Squashing thresholds, max_result_bytes, RESULT_BYTES) counted the whole input block per output block, and Squashing::squash copied it per output block. A materialized view flattening an array wrote 51 parts instead of 9 for a 1M-row insert, and a small filtered result failed max_result_bytes. Cut the passenger to the window before wrapping it, with window-local indexes, in both ArrayJoinResultIterator::next and nextWithElementFilter, as before ClickHouse#124727. Keep the rest of ClickHouse#124727, including getReferencedRowsBound, which still keeps sparse filtered windows lazy. The first_index parameter of convertOffsetsToIndexes has no non-zero caller left, so it is removed. Fixing the consumers instead was rejected: exact referenced-byte accounting needs an O(rows) index scan plus per-row byteSizeAt inside byteSize, which runs on every port push and pull, and a row-count share of the nested bytes undercharges variable-width rows. Price on a Release build (median of 7): the 10M-row lazy `SELECT x, str ... ARRAY JOIN arr AS x FORMAT Null` query that ClickHouse#124727 added goes from 0.200 s to 0.345 s; its other four lazy queries are within noise. Closes ClickHouse#126081 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):
Improves ARRAY JOIN performance for queries with wide passenger columns by avoiding unnecessary passenger cuts and preserving lazy replication through filtering and sorting.
Workflow [PR]
Sync PR [sync-upstream/pr/124727]
Version info
26.10.1.2498-master(included in26.10and later)