Repository navigation
Allow multiline queries in clickhouse-benchmarks - #99972
alexey-milovidov merged 8 commits into
Conversation
|
Workflow [PR], commit [fa2cd1f] Summary: ✅ AI ReviewSummaryThis PR introduces Findings
Final VerdictStatus: Minimum required action:
|
|
Ok, but the PR description is still wrong, and I'm concerned about the setting name. It implies that without this option, clickhouse-benchmark can't process multiple queries, which is untrue. |
|
Let's name it |
Address review feedback on PR ClickHouse#99972: rename the previously added `-m`, `--multiquery` flag to `--queries-format` with two possible values: - `tsv` (default) - one tab-escaped query per line (existing behavior) - `script` - parse stdin as a script of queries separated by `;` The new name better reflects that `clickhouse-benchmark` already supports multiple queries by default, and only the input *format* changes. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Renamed |
| if (options.contains("help")) | ||
| { | ||
| std::cout << "Usage: " << argv[0] << " [options] < queries.txt\n"; | ||
| std::cout << "Usage: clickhouse benchmark [options] < queries.txt\n"; |
There was a problem hiding this comment.
--help now prints a hardcoded clickhouse benchmark command. mainEntryClickHouseBenchmark is used by the standalone clickhouse-benchmark binary too, so this can show users a command that does not exist in their install.
Can we avoid hardcoding here (e.g. use argv[0] like before, or print both invocation forms)?
|
This was fixed by #105146. Let's update the branch. |
|
The BuzzHouse failure ([Logical error: Addressed reviewer feedback: removed the unnecessary @groeneai, could you investigate the |
|
@alexey-milovidov — investigated and submitted a fix as #105286. Reproducer (deterministic, master HEAD): CREATE TABLE mem (id UInt64, value String) ENGINE = Memory;
INSERT INTO mem VALUES (1, 'a'), (2, 'b');
INSERT INTO mem VALUES (3, 'c'), (4, 'd');
ALTER TABLE mem (APPLY PATCHES);
-- Logical error: 'Mutation of `Memory` table produced incomplete output:
-- block 0 has 0 rows, expected 2'.Root cause: Fix: Cross-link to the umbrella tracker for this STID family (originally STID 2380-278c
This PR should clear the |
431c646 to
fa2cd1f
Compare
LLVM Coverage Report
Changed lines: 95.65% (44/46) · Uncovered code |
`ALTER TABLE <memory_tbl> (APPLY PATCHES)` (and the equivalent
`APPLY DELETED MASK`) used to raise
Logical error: Mutation of `Memory` table produced incomplete output:
block 0 has 0 rows, expected N
(`STID: 2380-3043`, surfaced by `BuzzHouse` on master and 8+ unrelated PRs
in a 24h window).
`MutationsInterpreter::prepare` short-circuits both commands without adding
a mutation stage (`MutationsInterpreter.cpp:1238-1243`). On a `Memory` table
the resulting pipeline still pulls one output block per input block, but
each one has zero rows. `StorageMemory::mutate` then walks the partial-column
path and fails the per-block row-count invariant.
`Memory` tables do not own patch parts (lightweight updates are a `MergeTree`
feature) and do not maintain a `_row_exists` deletion mask, so both commands
are semantically no-ops here: the post-state the user is asking for (all
patches applied, all deleted rows physically removed) is already satisfied.
Filter them out before constructing the mutation pipeline; if all commands
are filtered, return immediately. A `UPDATE` or `DELETE` mixed in the same
`ALTER` still executes normally.
CI report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99972&sha=f7959f604f297d728373e5f6ed753d9a0bde5a3c&name_0=PR&name_1=BuzzHouse%20%28amd_tsan%29
Reported on ClickHouse#99972
Regression test `04254_memory_apply_patches_no_op` exercises:
- parenthesised `(APPLY PATCHES)` (the `BuzzHouse` form)
- bare `APPLY PATCHES`
- `APPLY DELETED MASK`
- mixed `UPDATE ... , APPLY PATCHES SETTINGS mutations_sync = 1`
Add
--queries-formatoption toclickhouse-benchmarkfor choosing how the queries on standard input are interpreted.Before this change,
clickhouse-benchmarkalways read stdin as one tab-escaped query per line. That works for the original use case (a TSV-formatted file produced by ClickHouse itself) but is awkward for hand-written multi-line queries or for replaying a.sqlscript.--queries-formathas two values:tsv(default) - one tab-escaped query per line; existing behavior, no change for current users.script- parse stdin as a script of multiple queries separated by;(using the samesplitMultipartQuerylogic asclickhouse-client). Multi-line queries are allowed. Limitation:INSERT ... FORMATqueries must be on a single line, as inclickhouse-client.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Added
--queries-formatoption toclickhouse-benchmarkto choose between the default tab-escaped one-query-per-line input (tsv) and parsing standard input as a script of multiple queries separated by;(script).Documentation entry for user-facing changes
Version info
26.5.1.836