Skip to content

Expose Parser::into_comments#2354

Merged
iffyio merged 2 commits into
apache:mainfrom
xitep:main
May 28, 2026
Merged

Expose Parser::into_comments#2354
iffyio merged 2 commits into
apache:mainfrom
xitep:main

Conversation

@xitep
Copy link
Copy Markdown
Contributor

@xitep xitep commented May 27, 2026

  • Back then we didn't make the method public to guarantee the binary search over the comments
  • Later in the process we skipped adding out-of-order comments: https://github.com/apache/datafusion-sqlparser-rs/blob/main/src/ast/comments.rs#L40
  • therefore exposing the method should be just fine now
  • exposing the method allows to use the parser (e.g. extract the statements individually) and still obtain the Comments instances without calling parse_sql_with_comments

Copy link
Copy Markdown
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @xitep!

@iffyio iffyio added this pull request to the merge queue May 28, 2026
Merged via the queue into apache:main with commit b6af2ae May 28, 2026
10 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.

2 participants