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

Sqlparser Benchmarks are erroring #1559

Closed
alamb opened this issue Nov 26, 2024 · 0 comments · Fixed by #1560
Closed

Sqlparser Benchmarks are erroring #1559

alamb opened this issue Nov 26, 2024 · 0 comments · Fixed by #1560
Assignees

Comments

@alamb
Copy link
Contributor

alamb commented Nov 26, 2024

Fix benchmarks so they don't error

Inspired by @Nyrox's comment #1435 (comment), I spent some time looking at the benchmarks for the SQL parser and found that they were erroring out 😱

So basically the benchmarks are testing the speed of generating errors.

Right now, errors are ignored, but when I changed that I found that the benchmarks were erroring out:

diff --git a/sqlparser_bench/benches/sqlparser_bench.rs b/sqlparser_bench/benches/sqlparser_bench.rs
index 27c58b4..93c18fe 100644
--- a/sqlparser_bench/benches/sqlparser_bench.rs
+++ b/sqlparser_bench/benches/sqlparser_bench.rs
@@ -25,7 +25,7 @@ fn basic_queries(c: &mut Criterion) {

     let string = "SELECT * FROM table WHERE 1 = 1";
     group.bench_function("sqlparser::select", |b| {
-        b.iter(|| Parser::parse_sql(&dialect, string));
+        b.iter(|| Parser::parse_sql(&dialect, string).unwrap());
     });

     let with_query = "
@@ -40,7 +40,7 @@ fn basic_queries(c: &mut Criterion) {
         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());
     });
 }
cargo bench
...
     Running benches/sqlparser_bench.rs (target/release/deps/sqlparser_bench-0a4654f932bbac9e)
Gnuplot not found, using plotters backend
Benchmarking sqlparser-rs parsing benchmark/sqlparser::select: Warming up for 3.0000 sthread 'main' panicked at benches/sqlparser_bench.rs:28:55:
called `Result::unwrap()` on an `Err` value: ParserError("Expected: (, found: WHERE at Line: 1, Column: 21")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: bench failed, to rerun pass `--bench sqlparser_bench`
@alamb alamb changed the title Benchmarks are erroring Sqlparser Benchmarks are erroring Nov 26, 2024
@alamb alamb self-assigned this Nov 26, 2024
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 a pull request may close this issue.

1 participant