Core SQL test harness: the shim does not skip comments inside SET and USE statements
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 70/100
Direzione di ricerca
Inizia in tests/clickhouse-test-runner/ClickHouse.Driver.TestRunner/Runner.cs: ParseSetAssignments (intorno alle righe 107-145) rimuove i commenti solo prima di SET, e ParseUseDatabase (intorno alle righe 78-80) li mantiene e ferma DATABASE solo in corrispondenza di uno spazio. Compila lo shim con tests/clickhouse-test-runner/scripts/build.sh e riproduci con i set.sql/use.sql forniti sia su http sia su tcp prima di modificare. Fatto significa che lo shim stampa lo stesso output di clickhouse-client per quei passaggi, incluso il commento don't e la tabulazione dopo USE DATABASE.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
The shim of the core SQL test harness (tests/clickhouse-test-runner) reads the SET and USE statements of a test to follow the session state, as clickhouse-client does. A comment inside such a statement gives a result that is different from clickhouse-client, over both protocols (http, tcp):
SET: a setting after a comment keeps its command-line value (--max_threads=7) on each later query, so it overrides the value that the test set. A comment with a'(-- don't) does this for all the assignments after it.SET: a comment in the value of an output setting (format_tsv_null_representation) becomes part of the value that the shim prints.USE: a comment afterUSE, or a tab or a newline afterUSE DATABASE, stops the test withcannot read the database name.
No test of the pinned suite changes its result today: at v26.10.4.207, only 04277_parallel_replicas_join_dp_reorder (not in the allowlist) has a comment inside SET, and the shim does not track the setting after that comment. A new upstream test with this form fails for a shim cause.
Steps to reproduce
- Start the pinned server (README, step 1) and build the shim:
tests/clickhouse-test-runner/scripts/build.sh. tests/clickhouse-test-runner/.bin/clickhouse-client --max_threads=7 --max_insert_threads=7 < set.sqltests/clickhouse-test-runner/.bin/clickhouse-client < use.sqltests/clickhouse-test-runner/.bin/clickhouse-client --query "$(printf 'USE DATABASE\trepro_db')"
Run each step again with CLICKHOUSE_TEST_RUNNER_PROTOCOL=tcp, and with clickhouse-client in the server container.
Expected behaviour
The output of clickhouse-client 26.10.4.207 for the same steps:
step 2: 1 1 NULL
step 3: repro_db
step 4: no output, exit code 0
Code example
set.sql:
SET
max_block_size = 100,
-- one thread
max_threads = 1;
SET
-- don't use more threads
max_block_size = 100,
max_insert_threads = 1;
SET format_tsv_null_representation = 'NULL' /* text of NULL */;
SELECT getSetting('max_threads'), getSetting('max_insert_threads'), NULL;
use.sql:
CREATE DATABASE IF NOT EXISTS repro_db;
USE /* the test database */ repro_db;
SELECT currentDatabase();
Error log
Shim output, the same over http and tcp:
step 2: 7 7 'NULL' /* text of NULL */
step 3: Error: InvalidOperationException: clickhouse-test-runner: cannot read the database name of "USE /* the test database */ repro_db;"
step 4: Error: InvalidOperationException: clickhouse-test-runner: cannot read the database name of "USE DATABASE repro_db"
Root cause
tests/clickhouse-test-runner/ClickHouse.Driver.TestRunner/Runner.cs:107-145(ParseSetAssignments): it skips comments only beforeSET, then splits the rest on,and=with the comments in place. A comment becomes part of the next setting name or of the value, soAfterSuccess(line 267) does not remove the command-line setting. A'in a comment starts a string literal at line 130, which hides the commas after it.Runner.cs:78-80(ParseUseDatabase): it keeps comments in the database name, and it finds the end ofDATABASEonly at a space.
The fix is in these two functions of the shim only.
Polyglot AI can open a fix PR if a maintainer assigns this issue to @polyglotAI-bot.
Configuration
Environment
- Client version:
mainat 9267d729 (the shim is not in the package) - .NET version: net10.0 (SDK 10.0.404)
- OS: Linux (container)
ClickHouse server
- ClickHouse Server version: 26.10.4.207
- ClickHouse Server non-default settings, if any: none
Classification: impact: none · area: Docs & project (core SQL test harness)
Found by automated analysis (Polyglot AI) while working on ClickHouse/clickhouse-connect#1223. Verified against a live server.
- Lingua principale
- C#
- Stelle
- 101
- Fork
- 28
- Merge medio
- 2g 11h
- PR unite (30g)
- 30
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ClickHouse/clickhouse-cs
-
AcceptEncodingWireTests fail on Windows, 15 of 16, with a connection resetForse già presa @enigmatic-postulate l’ha presa oggi. Apertabug tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
ClickHouse/clickhouse-cs#779 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug data-types native-format
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
ClickHouse/clickhouse-cs#730 ·
I maintainer di solito rispondono entro 1 giorno
-
bug data-types
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ClickHouse/clickhouse-cs#720 ·
I maintainer di solito rispondono entro 1 giorno
-
ClickHouseDataSource: DisposeAsync() (and await using) does not dispose the owned ClickHouseClient/HttpClientForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaapi-diagnostics bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/clickhouse-cs#689 ·
I maintainer di solito rispondono entro 1 giorno
-
Every query fails with Code 164 (READONLY) for a readonly = 1 user: the driver always sends enable_http_compression and input_format_binary_read_json_as_string as settingsForse già presa @polyglotAI-bot l’ha presa 52 giorni fa. Apertabug configuration
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/clickhouse-cs#659 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ClickHouse/clickhouse-cs
Issue simili
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
dotnet/maui#40788 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
erkamyaman/rust-anything#943 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SixLabors/ImageSharp.Drawing#438 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100