Skip to content

Substitute the test runner's database parameters - #144

Merged
kyleconroy merged 1 commit into
claude/project-thread-wk8rxb-genfrom
claude/project-thread-wk8rxb-params
Dec 1, 2026
Merged

kyleconroy merged 1 commit into
claude/project-thread-wk8rxb-genfrom
claude/project-thread-wk8rxb-params

Conversation

@kyleconroy

Copy link
Copy Markdown
Collaborator

Requested by Kyle · project thread

Summary

Stacked on #143. This fixes the second explain-generator gap found in #139.

Statements that use {CLICKHOUSE_DATABASE:Identifier}, {CLICKHOUSE_DATABASE_1:String} and similar never got explain files. Without a value ClickHouse refuses to explain them (UNKNOWN_QUERY_PARAMETER). With a value, it substitutes it before printing the AST.

  • cmd/regenerate-explain now passes param_CLICKHOUSE_DATABASE=test_db (and _1, _2) on every request, as ClickHouse's own test runner does.
  • parser/parser_test.go substitutes the same names before parsing (substituteTestParams).

Only the six CLICKHOUSE_DATABASE* forms are substituted, so other query parameters still parse as QueryParameter. No existing explain file changed.

This adds 2,055 explain files across about 157 tests. 2,006 of those statements pass. The other 49, in 15 tests, are recorded in explain_todo for a follow-up.

Open question for review: these statements now test the substituted SQL, not the {param} syntax. That is the only ground truth ClickHouse can give for them.


Generated by Claude Code

Statements that use {CLICKHOUSE_DATABASE:Identifier} and similar never
got explain files, because ClickHouse refuses to explain them without a
value and substitutes the value before printing when one is given.
regenerate-explain now sends fixed values (test_db, test_db_1,
test_db_2), and the parser tests substitute the same names before parsing.

This adds 2,055 explain files. 2,006 statements pass; the other 49 are
recorded in explain_todo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4GWXBrmUXAf6RUPFSs
@kyleconroy kyleconroy self-assigned this Dec 1, 2026
@kyleconroy
kyleconroy added this pull request to stack #142 December 1, 2026 13:17
@kyleconroy
kyleconroy merged commit 5d3e658 into main Dec 1, 2026
1 check passed
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.

2 participants