-
Notifications
You must be signed in to change notification settings - Fork 1k
Remove comments from query when parsing SET #4959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2.7-bump_version_to_2.7.3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,8 @@ std::map<std::string,std::vector<std::string>> SetParser::parse1() { | |
|
||
re2::RE2 re0("^\\s*SET\\s+", *opt2); | ||
re2::RE2::Replace(&query, re0, ""); | ||
re2::RE2 re2("--.*$", *opt2); // remove comments | ||
re2::RE2::Replace(&query, re2, ""); | ||
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This regex It's worth considering if other SQL comment types, such as If these other comment types can also cause parsing issues within |
||
re2::RE2 re1("(\\s|;)+$", *opt2); // remove trailing spaces and semicolon | ||
re2::RE2::Replace(&query, re1, ""); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change correctly adds removal of
--
comments for theparse1()
method using the regex"--.*$"
.However, the
parse1v2()
method (defined later in this file, e.g., lines 378-381 show its ownSET
prefix and suffix trimming) also parsesSET
statements but does not include similar logic to remove--
comments.Could this lead to inconsistent behavior or parsing failures if
parse1v2()
encountersSET
queries that include--
comments? Ifparse1v2()
is intended to have feature parity withparse1()
regarding comment handling forSET
statements, it might require a similar update to ensure consistent parsing behavior.