-
Notifications
You must be signed in to change notification settings - Fork 36
Add support for SHOW and DESC/DESCRIBE statements #180
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
Conversation
@git-hulk 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Pull Request Test Coverage Report for Build 16897702829Details
💛 - Coveralls |
Co-authored-by: git-hulk <[email protected]>
@copilot Fix the lint error. |
Co-authored-by: git-hulk <[email protected]>
@copilot Please add the new expr into Walk funciton. |
Co-authored-by: git-hulk <[email protected]>
This PR adds support for parsing SHOW and DESC/DESCRIBE statements in the ClickHouse SQL parser, resolving the "unexpected token" errors when using these common database commands.
Problem
The parser was throwing "unexpected token" errors for valid ClickHouse SQL statements like:
This was because the
parseStmt
function didn't include cases for the SHOW and DESC keywords, despite these keywords being defined in the lexer.Solution
Added comprehensive support for SHOW and DESC/DESCRIBE statements by:
Created new AST node types:
ShowStmt
- handles various SHOW commandsDescribeStmt
- handles DESC/DESCRIBE table commandsExtended the visitor pattern:
VisitShowExpr
andVisitDescribeExpr
methods to the ASTVisitor interfaceAdded parsing logic:
parseShowStmt
- supports SHOW CREATE TABLE, SHOW DATABASES, SHOW TABLESparseDescribeStmt
- supports both DESC and DESCRIBE keywordsparseStmt
functionFeatures Supported
SHOW CREATE TABLE table_name
- Shows CREATE TABLE statementSHOW DATABASES
- Lists databasesSHOW TABLES
- Lists tablesDESC table_name
- Describes table structureDESCRIBE table_name
- Describes table structure (synonym for DESC)database.table
)Testing
Added comprehensive test cases covering all supported statement types and edge cases. All existing tests continue to pass, ensuring no regressions were introduced.
Example usage:
Fixes #179.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.