Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,7 @@ utf16string = "0.2.0"
uuid = { version = "1.11.0", features = ["serde", "v4", "v7"] }
walkdir = "2.5.0"
zstd = { version = "0.13.2", features = ["experimental"] }

# Patch until upstream has been updated:
[patch.crates-io]
sqlparser_derive = { git = "https://github.com/apache/datafusion-sqlparser-rs", rev = "ade40826563451cc14c130af9d689f4050dbdb15" }
1 change: 0 additions & 1 deletion relay-event-normalization/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ serde_json = { workspace = true }
serde_urlencoded = { workspace = true }
smallvec = { workspace = true }
sqlparser = { workspace = true, features = ["visitor"] }

thiserror = { workspace = true }
url = { workspace = true }
uuid = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,8 @@ impl Dialect for DialectWithParameters {

#[cfg(test)]
mod tests {
use sqlparser::ast::{Visit, Visitor};

use super::*;

#[test]
Expand All @@ -881,6 +883,32 @@ mod tests {
);
}

#[test]
fn visit_deep_expression() {
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 test causes a stack overflow without the dependency patch in Cargo.toml.

struct TestVisitor;
impl Visitor for TestVisitor {
type Break = ();
}
let leaf = || Box::new(Expr::Value(Value::Null.into()));
let op = BinaryOperator::And;

let mut expr = Expr::BinaryOp {
left: leaf(),
op,
right: leaf(),
};

for _ in 0..10_000 {
expr = Expr::BinaryOp {
left: Box::new(expr),
op: BinaryOperator::And,
right: leaf(),
}
}

let _ = expr.visit(&mut TestVisitor);
}

#[test]
fn parse_dont_panic() {
assert!(parse_query_inner(None, "REPLACE g;'341234c").is_err());
Expand Down
Loading