FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support empty parentheses in index type definitions by Lance726 · Pull Request #224 · AfterShip/clickhouse-sql-parser · GitHub

Support empty parentheses in index type definitions - #224

Merged
git-hulk merged 1 commit into
AfterShip:masterfrom
Lance726:dev1
Dec 9, 2025
Merged

Support empty parentheses in index type definitions#224
git-hulk merged 1 commit into
AfterShip:masterfrom
Lance726:dev1

Conversation

Lance726 commented Dec 9, 2025
edited
Loading

Copy link
Copy Markdown
Collaborator

The parser previously failed on index types like TYPE bloom_filter() because it only handled:

  • Types with parameters: bloom_filter(0.001)
  • Types without parentheses: bloom_filter()

Now correctly parses types with empty parentheses () by returning a TypeWithParams with Params: nil.

Test Case

Added test case with INDEX idx_id idx TYPE bloom_filter() GRANULARITY 1 to verify the fix.

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 20059659103

Details

  • 9 of 9 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 51.104%

Totals
Change from base Build 20029580915: 0.03%
Covered Lines: 7985
Relevant Lines: 15625

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

This PR adds support for parsing index type definitions with empty parentheses (e.g., TYPE bloom_filter()). Previously, the parser only handled types with parameters like bloom_filter(0.001) or types without parentheses at all. The fix allows the parser to correctly handle the empty parentheses case by returning a TypeWithParams structure with Params: nil.

Key Changes

  • Added a new case in parseColumnType() to handle TokenKindRParen immediately after the opening parenthesis
  • Returns a properly structured TypeWithParams with nil params for empty parentheses
  • Added comprehensive test coverage including input SQL, formatted output, and golden JSON AST

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
parser/parser_column.go Added new case to handle empty parentheses in type definitions, returning TypeWithParams with nil Params
parser/testdata/ddl/create_table_with_index.sql Added test case with INDEX idx_id idx TYPE bloom_filter() GRANULARITY 1
parser/testdata/ddl/format/create_table_with_index.sql Updated formatted output to include the new test case with empty parentheses
parser/testdata/ddl/output/create_table_with_index.sql.golden.json Updated golden JSON output showing correct AST structure with Params: null

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

git-hulk merged commit 8e07af7 into AfterShip:master Dec 9, 2025
7 checks passed
orian referenced this pull request in orian/clickhouse-sql-parser May 13, 2026
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL