Correctly look for end delimiter dollar quoted string#1650
Merged
iffyio merged 7 commits intoapache:mainfrom Jan 12, 2025
Merged
Correctly look for end delimiter dollar quoted string#1650iffyio merged 7 commits intoapache:mainfrom
iffyio merged 7 commits intoapache:mainfrom
Conversation
Currently the tokenizer throws an error for ```sql SELECT $abc$x$ab$abc$ ``` The logic is also quite difficult to read so I made it a bit simpler.
Contributor
Author
|
Adding some more tests first |
Contributor
Author
|
@iffyio let me know if see some improvements |
iffyio
reviewed
Jan 10, 2025
src/tokenizer.rs
Outdated
| temp.push(ch); | ||
|
|
||
| if temp.ends_with(&end_delimiter) { | ||
| s.push_str(&temp[..temp.len() - end_delimiter.len()]); |
Contributor
There was a problem hiding this comment.
ah I think indexing based on String::len won't necessarily produce correct results on arbitrary UTF8 strings, we could something like strip_suffix that doesn't rely on the byte count? e.g
if let Some(temp) = temp.strip_suffix(&end_delimiter) {
s.push_str(temp);
break
}String::len won't necessarily produce correct results on arbitrary UTF8 strings
Contributor
Author
|
@iffyio Updated, thanks for your feedback! 🥇 |
ayman-sigma
pushed a commit
to sigmacomputing/sqlparser-rs
that referenced
this pull request
Apr 10, 2025
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
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.
Currently the tokenizer throws an error for
SELECT $abc$x$ab$abc$The logic is also quite difficult to read so I made it a bit simpler.
Before
After