-
Notifications
You must be signed in to change notification settings - Fork 93
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
chore(spans): Upgrade sqlparser #3057
Conversation
@@ -383,7 +383,7 @@ mod tests { | |||
scrub_sql_test!( | |||
strip_prefixes_mysql_generic, | |||
r#"SELECT `table`.`foo`, count(*) from `table` WHERE sku = %s"#, | |||
r#"SELECT foo, count(*) from table WHERE sku = %s"# | |||
r#"SELECT foo, count(*) FROM table WHERE sku = %s"# |
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 is now parsed successfully and no longer relies on the fallback scrubber.
r#"REPLACE INTO `foo` (`a`) VALUES ("abcd1234")"#, | ||
"REPLACE INTO foo (a) VALUES (%s)" | ||
"REPLACE INTO foo (..) VALUES (%s)" |
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 is now parsed successfully and no longer relies on the fallback scrubber.
TableFactor::Function { | ||
name, args, alias, .. | ||
} => { | ||
Self::simplify_compound_identifier(&mut name.0); | ||
for arg in args { | ||
if let FunctionArg::Named { name, .. } = arg { | ||
Self::scrub_name(name); | ||
} | ||
} | ||
Self::simplify_table_alias(alias); | ||
} | ||
TableFactor::JsonTable { columns, alias, .. } => { | ||
for col in columns { | ||
Self::scrub_name(&mut col.name); | ||
Self::simplify_table_alias(alias); | ||
} | ||
} | ||
TableFactor::Unpivot { | ||
value, | ||
name, | ||
columns, | ||
alias, | ||
.. | ||
} => { | ||
Self::scrub_name(value); | ||
Self::scrub_name(name); | ||
Self::simplify_compound_identifier(columns); | ||
Self::simplify_table_alias(alias); |
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 enum now has three new variants.
for operation in operations { | ||
match operation { |
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.
We now have to loop through multiple operations, hence the large diff.
TableFactor::JsonTable { columns, alias, .. } => { | ||
for col in columns { | ||
Self::scrub_name(&mut col.name); | ||
Self::simplify_table_alias(alias); |
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.
Do we need to simplify the alias for every column?
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.
Good catch!
Causes panics, see [RELAY-2NRB](https://sentry.my.sentry.io/organizations/sentry/issues/581392/). Reverts #3057 #skip-changelog
The `sqlparser` lib has been on a fork since #2846. We can now go back to the official version because apache/datafusion-sqlparser-rs#1065 has been merged & released.
The
sqlparser
lib has been on a fork since #2846. We can now go back to the official version because apache/datafusion-sqlparser-rs#1065 has been merged & released.ref: https://github.com/getsentry/team-ingest/issues/272