ms705 / nom-sql

Rust SQL parser written using nom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

parse sub query fail

zhuxiujia opened this issue · comments

commented
#[test]
fn test_nomsql() {
    let sql = r#"SELECT COUNT(*) FROM (SELECT id, user_id FROM test WHERE id = 1) t"#;
    let s=nom_sql::parser::parse_query(sql);
    if s.is_err(){
        panic!("{}",s.err().unwrap())
    }
}
running 1 test
test test_nomsql    ... FAILED

failures:

---- bench_nomsql stdout ----
thread 'main' panicked at 'failed to parse query', benches/bench_parser.rs:24:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/core/src/panicking.rs:64:14
   2: core::panicking::panic_display
   3: core::ops::function::FnOnce::call_once
   4: core::ops::function::FnMut::call_mut
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/core/src/ops/function.rs:337:5
   5: test::bench::Bencher::bench
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/test/src/bench.rs:56:22
   6: test::bench::benchmark::{{closure}}
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/test/src/bench.rs:208:51
   7: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/core/src/panic/unwind_safe.rs:271:9
   8: std::panicking::try::do_call
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/std/src/panicking.rs:483:40
   9: std::panicking::try
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/std/src/panicking.rs:447:19
  10: std::panic::catch_unwind
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/std/src/panic.rs:137:14
  11: test::bench::benchmark
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/test/src/bench.rs:208:18
  12: test::run_test
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/test/src/lib.rs:628:13
  13: test::run_tests
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/test/src/lib.rs:465:31
  14: test::console::run_tests_console
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/test/src/console.rs:293:5
  15: test::test_main
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/test/src/lib.rs:140:15
  16: test::test_main_static
             at /rustc/ec56537c4325ce5b798fc3628cbdd48ba4949ae5/library/test/src/lib.rs:159:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    bench_nomsql

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.01s

error: bench failed, to rerun pass `-p jdb --bench bench_parser`