-
Notifications
You must be signed in to change notification settings - Fork 38
Support DESCRIBE TABLE
syntax
#183
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enforces the official ClickHouse DESCRIBE TABLE
syntax by requiring the TABLE
keyword after DESC
/DESCRIBE
statements. The change ensures the parser strictly follows ClickHouse's documented syntax instead of accepting the invalid DESCRIBE <table_name>
form.
- Updated parser to require
TABLE
keyword afterDESC
/DESCRIBE
- Added
DescribeType
field to track the describe statement type - Updated all test files to use the correct
DESCRIBE TABLE
syntax
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
parser/ast.go | Added DescribeType field to DescribeStmt struct and updated String() method |
parser/parser_table.go | Added validation to require TABLE keyword after DESC/DESCRIBE |
parser/testdata/ddl/describe_table.sql | Updated test case to use DESCRIBE TABLE syntax |
parser/testdata/ddl/desc_table.sql | Updated test case to use DESC TABLE syntax |
parser/testdata/ddl/format/describe_table.sql | Updated expected format output for DESCRIBE TABLE |
parser/testdata/ddl/format/desc_table.sql | Updated expected format output for DESC TABLE |
parser/testdata/ddl/output/describe_table.sql.golden.json | Updated golden test output with new positions and DescribeType field |
parser/testdata/ddl/output/desc_table.sql.golden.json | Updated golden test output with new positions and DescribeType field |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Pull Request Test Coverage Report for Build 17151399017Details
💛 - Coveralls |
@dejanmltc Thanks for your fix. From the ClickHouse antlr, it looks like the keyword TABLE is optional for DESCRIBE|DESC statement. I tried it at the ClickHouse playground and confirmed it's a valid syntax by omitting the keyword TABLE: https://sql.clickhouse.com/?query=REVTQyBhbWF6b24uYW1hem9uX3Jldmlld3M. Would you mind making |
DESCRIBE TABLE
syntaxDESCRIBE TABLE
syntax
@git-hulk |
@dejanmltc Thank you! |
Reference: https://clickhouse.com/docs/sql-reference/statements/describe-table
This PR updates the SQL parser to handle the official ClickHouse
DESCRIBE TABLE <table_name>
syntax.Previously, only
DESCRIBE <table_name>
was supported. With this change,the parser now also accepts
DESCRIBE TABLE <table_name>
, which is thesyntax described in the official documentation.
Changes:
TABLE
keyword in DESCRIBE statements.DESCRIBE <table_name>
andDESCRIBE TABLE <table_name>
parse correctly.Justification:
(
DESCRIBE TABLE
) and the commonly used shorthand (DESCRIBE
).