-
Notifications
You must be signed in to change notification settings - Fork 612
Add #[recursive]
#1522
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
Add #[recursive]
#1522
Changes from 10 commits
73891ee
39f710d
90843ad
3af997b
1104f25
82b26f6
c9eef87
913a291
78effdf
34acb8b
5e3838b
505c271
b91baec
41c2424
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,46 @@ fn basic_queries(c: &mut Criterion) { | |
group.bench_function("sqlparser::with_select", |b| { | ||
b.iter(|| Parser::parse_sql(&dialect, with_query).unwrap()); | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I understood your comment, sorry. I added tests for parsing large statements in tests/sqlparser_common.rs. Do you think we should test something else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thinks it would be better to add as separated test. |
||
let large_statement = { | ||
let expressions = (0..1000) | ||
.map(|n| format!("FN_{}(COL_{})", n, n)) | ||
.collect::<Vec<_>>() | ||
.join(", "); | ||
let tables = (0..1000) | ||
.map(|n| format!("TABLE_{}", n)) | ||
.collect::<Vec<_>>() | ||
.join(" JOIN "); | ||
let where_condition = (0..1000) | ||
.map(|n| format!("COL_{} = {}", n, n)) | ||
.collect::<Vec<_>>() | ||
.join(" OR "); | ||
let order_condition = (0..1000) | ||
.map(|n| format!("COL_{} DESC", n)) | ||
.collect::<Vec<_>>() | ||
.join(", "); | ||
|
||
format!( | ||
"SELECT {} FROM {} WHERE {} ORDER BY {}", | ||
expressions, tables, where_condition, order_condition | ||
) | ||
}; | ||
|
||
group.bench_function("parse_large_statement", |b| { | ||
b.iter(|| Parser::parse_sql(&dialect, criterion::black_box(large_statement.as_str()))); | ||
}); | ||
|
||
let large_statement = Parser::parse_sql(&dialect, large_statement.as_str()) | ||
.unwrap() | ||
.pop() | ||
.unwrap(); | ||
|
||
group.bench_function("format_large_statement", |b| { | ||
b.iter(|| { | ||
let formatted_query = large_statement.to_string(); | ||
assert_eq!(formatted_query, large_statement); | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, basic_queries); | ||
|
Uh oh!
There was an error while loading. Please reload this page.