Skip to content

Pass max_block_size and EXPLAIN settings via the protocol, not SETTINGS clause#263

Merged
azat merged 1 commit into
mainfrom
per-query-driver-settings
Jun 17, 2026
Merged

Pass max_block_size and EXPLAIN settings via the protocol, not SETTINGS clause#263
azat merged 1 commit into
mainfrom
per-query-driver-settings

Conversation

@azat

@azat azat commented Jun 17, 2026

Copy link
Copy Markdown
Owner

execute_for_each() appended "SETTINGS max_block_size=8192" to the SQL, which produced a duplicate SETTINGS clause for queries that already carry their own (stack_traces_for_perfetto's allow_introspection_functions=1). Use the driver's new per-query Query::with_setting() so the block-size cap rides the native protocol and composes with any in-SQL SETTINGS.

explain() had the same shape: it appended the query's settings as a SETTINGS clause onto original_query, which can already end with SETTINGS — the duplicate is dropped from EXPLAIN SYNTAX output. Pass those settings through the protocol too (execute() now takes impl Into), as the old NOTE suggested.

get_query() no longer detects an existing SETTINGS clause to merge into: ClickHouse accepts multiple SETTINGS clauses, so it always appends its own.

…GS clause

execute_for_each() appended "SETTINGS max_block_size=8192" to the SQL, which
produced a duplicate SETTINGS clause for queries that already carry their own
(stack_traces_for_perfetto's allow_introspection_functions=1). Use the driver's
new per-query Query::with_setting() so the block-size cap rides the native
protocol and composes with any in-SQL SETTINGS.

explain() had the same shape: it appended the query's settings as a SETTINGS
clause onto original_query, which can already end with SETTINGS — the duplicate
is dropped from EXPLAIN SYNTAX output. Pass those settings through the protocol
too (execute() now takes impl Into<Query>), as the old NOTE suggested.

get_query() no longer detects an existing SETTINGS clause to merge into:
ClickHouse accepts multiple SETTINGS clauses, so it always appends its own.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@azat azat merged commit dfd2092 into main Jun 17, 2026
9 checks passed
@azat azat deleted the per-query-driver-settings branch June 17, 2026 10:14
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