Skip to content

Send big list parts for distributed index analysis as scalars - #110419

Merged
azat merged 6 commits into
ClickHouse:masterfrom
azat:dia-parts-as-scalars
Jul 17, 2026
Merged

azat merged 6 commits into
ClickHouse:masterfrom
azat:dia-parts-as-scalars

Conversation

@azat

@azat azat commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Send big list parts for distributed index analysis as scalars (avoids possible failures due to max_ast_elements/max_query_size and removes AST parsing overhead)

Version info

  • Merged into: 26.7.1.1085 (included in 26.7 and later)

@azat
azat requested a review from KochetovNicolai July 14, 2026 16:57
@clickhouse-gh

clickhouse-gh Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3944396]

Summary: ❌

job_name test_name status info comment
Stress test (amd_asan_ubsan) FAIL
Cannot start clickhouse-server FAIL cidb
Check failed FAIL cidb

AI Review

Summary

This PR adds clickhouse-client --external --scalar support and switches distributed index analysis to send large part lists as scalars instead of inlining them into the query text. The core serialization changes look reasonable, but two compatibility paths are still broken, so I would not merge this yet.

Findings

⚠️ Majors

  • [src/Client/ClientBase.cpp:581] The new user-facing --external --scalar path still inherits Connection::sendScalarsData's silent no-op for pre-DBMS_MIN_REVISION_WITH_SCALARS servers (src/Client/Connection.cpp:1202-1208). That means clickhouse-client --external --scalar ... will either fail later with Scalar 'name' doesn't exist or quietly ignore the uploaded scalar, even though the option is now documented. [dismissed by author -- https://github.com/Send big list parts for distributed index analysis as scalars #110419#discussion_r3595901347] Suggested fix: reject --scalar explicitly once the connection revision is known instead of dropping the payload silently.
  • [src/Interpreters/ClusterProxy/distributedIndexAnalysis.cpp:154] The 30+ part rewrite to __getScalar('parts') still breaks when allow_experimental_analyzer = 0. MultiplexedConnections::sendQuery explicitly forces that setting onto every remote replica (src/Client/MultiplexedConnections.cpp:185-189), while extractParts in the old table-function path only accepts literal arrays / array(...) (src/TableFunctions/TableFunctionMergeTreeAnalyzeIndexes.cpp:48-80). In that mode the remote mergeTreeAnalyzeIndexesUUID call throws Parts must be an array of strings and the feature falls back to initiator-side analysis; the new test only covers allow_experimental_analyzer=1 (tests/queries/0_stateless/04600_distributed_index_analysis_scalars.sql:20). [dismissed by author -- https://github.com/Send big list parts for distributed index analysis as scalars #110419#discussion_r3585532902] Suggested fix: keep the inline ['...'] form when the initiator is running the old analyzer, or teach extractParts to evaluate __getScalar / other constant expressions before validating the array.
Final Verdict

Changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jul 14, 2026
@azat
azat force-pushed the dia-parts-as-scalars branch from bcf4cd9 to 1297e2d Compare July 14, 2026 17:27
Comment thread src/Client/Connection.cpp Resolved
Comment thread src/Core/ExternalTable.cpp Resolved
@azat
azat force-pushed the dia-parts-as-scalars branch from 0037105 to 1dc1204 Compare July 15, 2026 17:46
Comment thread src/Core/ExternalTable.cpp Resolved
azat added 3 commits July 15, 2026 21:00
This will allow to avoid query/AST limits and remove AST parsing.

Though parts will be still send inline in case of number of parts is not
too big.
@azat
azat force-pushed the dia-parts-as-scalars branch from 1dc1204 to 30c5cb4 Compare July 15, 2026 19:00
@KochetovNicolai KochetovNicolai self-assigned this Jul 16, 2026
Comment thread src/Core/ExternalTable.h Resolved
Comment thread src/Client/ClientBase.cpp Resolved
@azat
azat enabled auto-merge July 16, 2026 14:09
@clickhouse-gh

clickhouse-gh Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.90% 86.00% +0.10%
Functions 92.70% 92.70% +0.00%
Branches 78.10% 78.10% +0.00%

Changed lines: Changed C/C++ lines covered: 98/107 (91.59%) · Uncovered code

Full report · Diff report

@azat

azat commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

@azat
azat added this pull request to the merge queue Jul 17, 2026
Merged via the queue into ClickHouse:master with commit 7fbf503 Jul 17, 2026
175 of 178 checks passed
@azat
azat deleted the dia-parts-as-scalars branch July 17, 2026 10:58
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 17, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Send big list parts for distributed index analysis as scalars
PedroTadim added a commit that referenced this pull request Oct 29, 2026
…he_bypass` on 26.3

`clickhouse-client --external ... --scalar` came with #110419, which is not in 26.3, so the client
ends the external group at `--scalar` and rejects the following `--file=` as an ambiguous option.
Keep the policy baseline and the distributed scalar checks.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=127824&sha=5d92a7dcc4a582e404c63969284411152f71d735&name_0=BackportPR&name_1=Stateless%20tests%20%28amd_asan%2C%20distributed%20plan%2C%20parallel%2C%201%2F2%29
PR: #127824

Co-Authored-By: Claude Opus 5.5 <[email protected]>
leshikus pushed a commit that referenced this pull request Nov 13, 2026
…he_bypass` on 26.3

`clickhouse-client --external ... --scalar` came with #110419, which is not in 26.3, so the client
ends the external group at `--scalar` and rejects the following `--file=` as an ambiguous option.
Keep the policy baseline and the distributed scalar checks.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=127824&sha=5d92a7dcc4a582e404c63969284411152f71d735&name_0=BackportPR&name_1=Stateless%20tests%20%28amd_asan%2C%20distributed%20plan%2C%20parallel%2C%201%2F2%29
PR: #127824

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants