test: add SQL validation e2e test suite via EXPLAIN AST#83
Merged
Conversation
Validates that all generated SQL (CREATE, ALTER, migration plans) is syntactically valid ClickHouse SQL. Uses ClickHouse's EXPLAIN AST to parse SQL without executing DDL. Comprehensive coverage: 80+ test cases covering primitive/parameterized/complex types, defaults, comments, all engine families, indexes, projections, TTL, settings, views, and migration plans. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
toCreateSQL runs assertValidDefinitions which rejects expressions like toDate(created_at) in orderBy. Use raw SQL for this edge case to test ClickHouse parsing without hitting the schema validator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
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.
Summary
Adds comprehensive e2e test suite for SQL generation validation. All generated SQL (CREATE TABLE/VIEW/MV, ALTER operations, migration plans) is validated via ClickHouse's EXPLAIN AST parser — catching malformed SQL, bad quoting, missing clauses without executing any DDL.
Coverage: 80+ test cases — primitive types, parameterized types, complex/nested types, defaults, comments, nullable columns, all 6 MergeTree engine variants, PARTITION BY expressions, ORDER BY/PRIMARY KEY, TTL, SETTINGS, all 5 skip index types, projections, table comments, reserved word column names, deeply nested types, and full migration plan diffs.
Test plan
bun run buildpasses (no circular dependency)bun run typecheckpassesbun run lintpasses on modified packages🤖 Generated with Claude Code