Skip to content
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

fix(spans): Parse quotes in MySQL #2846

Merged
merged 3 commits into from
Dec 19, 2023
Merged

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented Dec 12, 2023

Some of the dialect-specific parsing logic did not apply because we use a wrapped dialect DialectWithParameters, which has the wrong type_id().

Until sqlparser-rs/sqlparser-rs#1065 gets merged, use a fork of sqlparser to make DialectWithParameters behave like the underlying dialect.

ref: #2847

@jjbayer jjbayer changed the title test fix(spans): Parse quotes in MySQL Dec 12, 2023
@jjbayer
Copy link
Member Author

jjbayer commented Dec 14, 2023

Blocked on sqlparser-rs/sqlparser-rs#1065.

Comment on lines +628 to +640
scrub_sql_test_with_dialect!(
mysql_escape_quote,
"mysql",
r#"SELECT "Wayne's World""#,
"SELECT %s"
);

scrub_sql_test_with_dialect!(
mysql_escape_double_quote,
"mysql",
r#"SELECT "{\"json\": \"yes\"}""#,
"SELECT %s"
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests would previously fail.

Comment on lines +432 to +434
fn dialect(&self) -> std::any::TypeId {
self.0.dialect()
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This informs the parser to treat the current dialect the same as the wrapped dialect, for example MySQL.

@jjbayer jjbayer marked this pull request as ready for review December 19, 2023 08:21
@jjbayer jjbayer requested a review from a team as a code owner December 19, 2023 08:21
@@ -429,6 +429,10 @@ impl DialectWithParameters {
}

impl Dialect for DialectWithParameters {
fn dialect(&self) -> std::any::TypeId {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we #[inline]?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we?

Note: The rustc compiler automatically inlines functions based on internal heuristics. Incorrectly inlining functions can make the program slower, so this attribute should be used with care.

https://doc.rust-lang.org/stable/reference/attributes/codegen.html?highlight=inline#the-inline-attribute

@jjbayer jjbayer merged commit fe57b99 into master Dec 19, 2023
20 checks passed
@jjbayer jjbayer deleted the fix/spans-msql-parse-quotes branch December 19, 2023 14:24
jan-auer added a commit that referenced this pull request Dec 19, 2023
* master: (35 commits)
  fix(spans): Parse quotes in MySQL (#2846)
  ref(cardinality): Use a Lua script and in-memory cache for the cardinality limiter (#2849)
  fix(spans): Detect hex with fallback scrubber (#2868)
  release: 23.12.0
  Revert "ci: Update upload-artifact and download-artifact actions" (#2866)
  Revert "build: Update axum and http" (#2863)
  feat(spans): Allow resource.img spans (#2855)
  build: Update axum and http (#2844)
  fix(build): Add additional dependencies to the release build (#2858)
  ci: Update upload-artifact and download-artifact actions (#2861)
  feat(spans): Parse timestamps from strings (#2857)
  fix(spans): Scrub integer file extensions (#2856)
  feat(spans): Remove unused transaction tag from resource metrics (#2853)
  ref(cardinality): Recover buckets on cardinality limiter failure (#2852)
  feat(server): Org rate limit per metric bucket (#2836)
  ref(spans): List metric tags explicitly (#2834)
  feat(spans): Resource response sizes as measurements (#2845)
  feat(crons): Add thresholds to monitor config payload (#2842)
  feat(spans): Allow ingestion of metrics summary on spans (#2823)
  ref(crons): Add documentation to CheckInMessageType (#2840)
  ...
jan-auer added a commit that referenced this pull request Dec 20, 2023
* master:
  feat(processor): Add a metric to track the time of all messages (#2877)
  build(py): Update to python 3.9 (#2876)
  fix(spans): Collapse constants in SQL select (#2867)
  fix(spans): Parse quotes in MySQL (#2846)
  ref(cardinality): Use a Lua script and in-memory cache for the cardinality limiter (#2849)
  fix(spans): Detect hex with fallback scrubber (#2868)
jjbayer added a commit that referenced this pull request Feb 6, 2024
The `sqlparser` lib has been on a fork since
#2846. We can now go back to the
official version because
sqlparser-rs/sqlparser-rs#1065 has been merged &
released.
jjbayer added a commit that referenced this pull request Feb 6, 2024
The `sqlparser` lib has been on a fork since
#2846. We can now go back to the
official version because
sqlparser-rs/sqlparser-rs#1065 has been merged &
released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants