Conversation
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.
jjbayer
commented
Feb 8, 2024
Comment on lines
+885
to
+888
| scrub_sql_test!( | ||
| replace_into_set_dont_panic, | ||
| r#"REPLACE INTO `foo` SET x = y"#, | ||
| "REPLACE INTO foo SET x = y" |
Member
Author
There was a problem hiding this comment.
Without the catch_unwind, this test made parse_query panic.
Comment on lines
+34
to
+38
| relay_log::error!( | ||
| tags.db_system = db_system, | ||
| query = query, | ||
| "parse_query panicked", | ||
| ); |
Member
Author
There was a problem hiding this comment.
This will help us collect cases that we can then fix upstream.
Dav1dde
approved these changes
Feb 8, 2024
| ) -> Result<Vec<Statement>, sqlparser::parser::ParserError> { | ||
| match std::panic::catch_unwind(|| parse_query_inner(db_system, query)) { | ||
| Ok(res) => res, | ||
| Err(_) => { |
Member
There was a problem hiding this comment.
Does the error not contain interesting information (maybe a stacktrace)?
Member
Author
There was a problem hiding this comment.
It probably does, but how do I extract it? The error type is Box<dyn Any + Send>.
Member
There was a problem hiding this comment.
Actually misread the return type. It contains whatever was passed to panic!() (almost always some kind of string):
fn main() {
if let Err(e) = std::panic::catch_unwind(|| panic!("test")) {
println!("oops {:?}", e.downcast_ref::<&'static str>());
}
let r = 123;
if let Err(e) = std::panic::catch_unwind(|| panic!("oops {r}")) {
println!("oops {:?}", e.downcast_ref::<String>());
}
}So in our case it could be useful but most likely it's just a unwrap() somewhere.
iker-barriocanal
approved these changes
Feb 8, 2024
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.
This PR reapplies #3057, which was reverted because of panics.
As a workaround, catch unwind panics so we can collect panic cases and report them upstream.
#skip-changelog (false positive)