altmannmarcelo commented on PR #2216:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2216#issuecomment-3896245556
Thanks for the review @xitep, and glad you like the generalization!
I understand the appeal of dialect flags — they're great when the parser
can definitively say "this syntax is valid/invalid for dialect X." However, I
think optimizer hints are a different category. The `/*+ ...
*/` pattern is an established convention precisely because it's a
standard way to extend functionality without requiring grammar changes.
Different systems (and even different versions of the same system)
recognize different hint keywords and prefixes, and the parser shouldn't
need to know about all of them.
The current approach keeps the parser's responsibility focused: if the
dialect supports optimizer hints (`supports_comment_optimizer_hint()`), collect
them all and let the downstream consumer decide which ones are
relevant. This is intentional — adding dialect flags for which prefixes
are allowed or how many hints are accepted would couple the parser to specific
hint conventions that are really consumer-level concerns.
For downstream projects, the filtering is straightforward — match on
prefix and ignore what you don't recognize. This is simpler and more flexible
than maintaining dialect flags that would need updating as hint
conventions evolve. It also means new prefix conventions can be adopted by
consumers without any changes to sqlparser-rs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]