-
Notifications
You must be signed in to change notification settings - Fork 1
Add regenerate-explain tool for multi-statement test cases #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This Go tool regenerates explain.txt files by splitting each query.sql into individual statements and running EXPLAIN AST via clickhouse local. For tests with multiple statements: - First statement → explain.txt - Subsequent statements → explain_N.txt (N = 2, 3, ...) Usage: ./regenerate-explain -test <name> # Process single test ./regenerate-explain # Process all tests ./regenerate-explain -dry-run # Preview statements
- Split query.sql into individual statements - Create subtest for each statement (stmt1, stmt2, etc.) - Check explain.txt for first statement, explain_N.txt for Nth statement - Skip statements beyond first if no explain file exists (not yet regenerated) - Skip tests with all statements commented out - Add explain files for 00002_system_numbers (13 statements) This allows tests with multiple SQL statements to verify each one against its corresponding explain output.
cb24f4b to
d149200
Compare
Update the regenerate-explain tool to only generate explain_N.txt files for statements 2+, preserving the existing explain.txt files for the first statement. This prevents version-specific differences in ClickHouse EXPLAIN AST output from modifying the golden files.
Generate EXPLAIN AST output for statements 2+ in query.sql files that contain multiple SQL statements. This enables the parser test to test each statement as a subtest. - 99,169 new explain_N.txt files generated - Existing explain.txt files preserved unchanged - Some statements skipped due to intentionally invalid SQL
Add nil checks to explainCreateQuery and explainRenameQuery to handle cases where the parser returns nil AST nodes wrapped in interfaces.
Add support for explain_todo in metadata.json to skip individual
statement subtests. This allows marking specific statements as
pending without skipping the entire test case.
Usage in metadata.json:
{"explain_todo": {"stmt2": true, "stmt5": true}}
This skips stmt2 and stmt5 subtests while running all other statements.
- Remove Todo field from testMetadata struct in parser_test.go - Remove -check-skipped flag and related logic - Remove todo key from 146 metadata.json files - Update cmd/next-test to only support -format flag - Update CLAUDE.md documentation The explain_todo key now provides more granular control for skipping specific statement tests within a test case.
Add a new -check-explain flag that runs tests marked in explain_todo to see if they now pass. Similar to -check-format but for explain tests. Usage: go test ./parser/... -check-explain -v 2>&1 | grep "EXPLAIN PASSES NOW" When a test passes, it automatically removes the statement from explain_todo in metadata.json.
Add explain_todo metadata entries for all currently failing stmt tests. This allows the test suite to pass while marking tests that need parser/explain implementation work. Updated 2700+ metadata.json files with statement-specific explain_todo entries.
Add a new -explain flag that finds tests with explain_todo entries, sorted by fewest pending statements first. This helps prioritize tests that are closest to being fully implemented. Usage: go run ./cmd/next-test -explain
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Go tool regenerates explain.txt files by splitting each query.sql
into individual statements and running EXPLAIN AST via clickhouse local.
For tests with multiple statements:
Usage:
./regenerate-explain -test # Process single test
./regenerate-explain # Process all tests
./regenerate-explain -dry-run # Preview statements