The testdata/ directory contains test cases from ClickHouse. Each test has:
query.sql- The SQL query to parseexplain.txt- DO NOT MODIFY - This is the ground truth output from ClickHouse'sEXPLAIN ASTcommand. Our parser must produce output that matches this exactly.metadata.json- Test metadata (todo, skip, etc.)ast.json- Optional golden file for AST regression testing
To fix a failing test, you must fix the parser to produce output matching explain.txt, never modify explain.txt itself.
Always run parser tests with a 5 second timeout:
go test ./parser/... -timeout 5sThe tests are very fast. If a test is timing out, it indicates a bug (likely an infinite loop in the parser).
After fixing parser issues, check if any skipped tests now pass:
go test ./parser -check-skipped -v 2>&1 | grep "PASSES NOW"Tests that output PASSES NOW can have their todo flag removed from metadata.json. This helps identify when parser improvements fix multiple tests at once.