alamb opened a new issue, #1559:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1559

   Fix benchmarks so they don't error
   
   Inspired by @Nyrox's comment 
https://github.com/apache/datafusion-sqlparser-rs/pull/1435#issuecomment-2500900961,
 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
   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());
        });
    }
   
   ```
   
   ```shell
   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`
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to