-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Parse enum/set values with sqlparser
#17133
Parse enum/set values with sqlparser
#17133
Conversation
Signed-off-by: Shlomi Noach <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Shlomi Noach <[email protected]>
EDIT: this comment became irrelevant thanks to 02b6c9b
input := `'with '' quote','and \n newline'` Previously: expect := []string{"with ' quote", "and \n newline"}
expect := []string{"with \\' quote", "and \\n newline"} |
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.
Like that this uses the proper parser now.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17133 +/- ##
==========================================
+ Coverage 67.42% 67.44% +0.01%
==========================================
Files 1571 1569 -2
Lines 252184 252109 -75
==========================================
- Hits 170043 170032 -11
+ Misses 82141 82077 -64 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Shlomi Noach <[email protected]>
I pushed a small change that uses |
Signed-off-by: Shlomi Noach <[email protected]>
Description
This is a minor refactor/cleanup PR, followup to #15493.
https://github.com/vitessio/vitess/pull/15493/files#diff-e6d36f19ff8893ef05db3d0b9297a87ed3a0ecb6cdf7486c93718344b2ac25f9 introduced a CSV-style parsing to the enum set (e.g.
'x-small','small','medium','large','x-large'
). In this PR we usesqlparser
to parse these values.sqlparser
cannot directly parse this, so we wrap around with a dummy query:We then parse the complete query. This is more wasteful, of course, as we need to parse a statement, cast to
AlterTable
, extractAddColumns
, and finally readEnumValues
. Nonetheless, this utilizes our de-facto parser and I think it's worth the overhead for the little use case this gets.Related Issue(s)
#15492
Checklist
Deployment Notes