Skip to content

Conversation

@Lance726
Copy link
Collaborator

@Lance726 Lance726 commented Dec 9, 2025

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.

@chatgpt-codex-connector
Copy link

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.

@coveralls
Copy link

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 Coverage Status
Change from base Build 20029580915: 0.03%
Covered Lines: 7985
Relevant Lines: 15625

💛 - Coveralls

Copy link

Copilot AI left a 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 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 git-hulk merged commit 8e07af7 into AfterShip:master Dec 9, 2025
7 checks passed
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.

3 participants