Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Surfaces location in
ParserError
to allow library users to be able to enrich error messages that are shown to end users. Theannotate_with_error
shows an example use case where we can generate an error string that shows the full query with the error displayed inline.For example, if I submit the following query:
I can take the error from parsing that, and use the extra location info to be able to generate the following:
This is a breaking change as it's touching
ParserError
, and downstream projects (datafusion) would be impacted by this (the custom sql parser in particular). I added inParserError::new_parser_error
to make the changes need relatively straightforward.Longer term, I think
ParserError
can be improved a bit more to allow even better diagnostics to be displayed to the end user. What I'm thinking:Obviously that's an even more breaking change, but I think it'd be worth it to make the errors returned to users very informative.