Skip to content

Fix error in benchmark queries #1560

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

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Changes from all commits
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
10 changes: 5 additions & 5 deletions sqlparser_bench/benches/sqlparser_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ fn basic_queries(c: &mut Criterion) {
let mut group = c.benchmark_group("sqlparser-rs parsing benchmark");
let dialect = GenericDialect {};

let string = "SELECT * FROM table WHERE 1 = 1";
let string = "SELECT * FROM my_table WHERE 1 = 1";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"table" is a keyword so you can't use it as a table name without putting it in quotes

group.bench_function("sqlparser::select", |b| {
b.iter(|| Parser::parse_sql(&dialect, string));
b.iter(|| Parser::parse_sql(&dialect, string).unwrap());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The unwrap now actually checks the error

});

let with_query = "
WITH derived AS (
SELECT MAX(a) AS max_a,
COUNT(b) AS b_num,
user_id
FROM TABLE
FROM MY_TABLE
GROUP BY user_id
)
SELECT * FROM table
SELECT * FROM my_table
LEFT JOIN derived USING (user_id)
";
group.bench_function("sqlparser::with_select", |b| {
b.iter(|| Parser::parse_sql(&dialect, with_query));
b.iter(|| Parser::parse_sql(&dialect, with_query).unwrap());
});
}

Expand Down