cswinter / LocustDB

Blazingly fast analytics database that will rapidly devour all of your data.
Other
1.62k stars 72 forks source link

'cargo test' panic - test_group_by_nullable attempt to add with overflow #165

Closed aratz-lasa closed 7 months ago

aratz-lasa commented 7 months ago

I'm getting a uint8 overflow when running cargo test. I've tried to debug it, but I lack a lot of context, and it's the first time reading Rust :) The overflow happens here: https://github.com/cswinter/LocustDB/blob/bc86bc950f7293a2220fcac09bfd9741b41adf8a/src/engine/operators/fuse_nulls.rs#L167

Stack trace:

running 56 tests
test lt_filter_on_offset_encoded_column ... ok
test test_average ... ok
test group_by_col_and_aliasing_const_cols ... ok
test test_addition ... ok
test test_colnames ... ok
test test_comparison_operators ... ok
test test_group_by_float ... ok
test test_group_by_limit ... ok
test test_group_by_negative_expression ... ok
test group_by_integer_filter_integer_lt ... ok
test test_group_by_nullable ... FAILED
test group_by_string_filter_string_eq ... ok
test test_is_null ... ok
test test_division ... ok
test test_like ... ok
test test_limit_offset ... ok
test test_like_mismatch ... ok
test test_and_or ... ok
test test_multiple_group_by_2 ... ok
test test_gen_table ... ok
test test_not_equals ... ok
test test_not_equals_2 ... ok
test test_not_like ... ok
test test_null_aggregators ... ok
test test_null_operators ... ok
test test_numeric_operators ... ok
test test_multiple_group_by ... ok
test test_order_by_expression ... ok
test test_not_regex ... ok
test test_order_by_float ... ok
test test_order_by_multiple ... ok
test test_overflow ... ok
test test_count_by_passenger_count_pickup_year_trip_distance ... ok
test test_regex ... ok
test test_select_nullable_integer ... ok
test test_select_nullable_string ... ok
test test_select_integer ... ok
test test_select_string ... ok
test test_select_twice ... ok
test test_sort_by_nullable ... ok
test test_sort_string ... ok
test test_sort_string_desc ... ok
test test_group_by_string ... ok
test test_string_packed_column ... ok
test test_min_max ... ok
test test_sum_2 ... ok
test test_composite_aggregate ... ok
test test_sum ... ok
test test_group_by_trip_id ... ok
test test_order_by_aggregate ... ok
test test_order_by_grouping ... ok
test test_column_with_null_partitions ... ok
test test_sparse_filter ... ok
test test_string_length ... ok
test test_top_n ... ok
test test_groupless_aggregate ... ok

failures:

---- test_group_by_nullable stdout ----
thread '<unnamed>' panicked at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/ops/arith.rs:109:1:
attempt to add with overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/std/src/panicking.rs:619:5
   1: core::panicking::panic_fmt
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/panicking.rs:127:5
   3: <u8 as core::ops::arith::Add>::add
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/ops/arith.rs:102:45
   4: <locustdb::engine::operators::fuse_nulls::FuseIntNulls<T> as locustdb::engine::operators::vector_operator::VecOperator>::execute
             at ./src/engine/operators/fuse_nulls.rs:167:28
   5: locustdb::engine::execution::executor::QueryExecutor::run_stage
             at ./src/engine/execution/executor.rs:528:17
   6: locustdb::engine::execution::executor::QueryExecutor::run
             at ./src/engine/execution/executor.rs:141:13
   7: locustdb::engine::planning::query::NormalFormQuery::run_aggregate
             at ./src/engine/planning/query.rs:377:9
   8: locustdb::engine::execution::query_task::QueryTask::run
             at ./src/engine/execution/query_task.rs:155:17
   9: <locustdb::engine::execution::query_task::QueryTask as locustdb::scheduler::task::Task>::execute
             at ./src/engine/execution/query_task.rs:355:9
  10: locustdb::scheduler::inner_locustdb::InnerLocustDB::worker_loop
             at ./src/scheduler/inner_locustdb.rs:93:17
  11: locustdb::scheduler::inner_locustdb::InnerLocustDB::start_worker_threads::{{closure}}
             at ./src/scheduler/inner_locustdb.rs:66:35
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'test_group_by_nullable' panicked at tests/query_tests.rs:48:60:
called `Result::unwrap()` on an `Err` value: Canceled
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/std/src/panicking.rs:619:5
   1: core::panicking::panic_fmt
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/result.rs:1652:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/result.rs:1077:23
   4: query_tests::test_query_ec
             at ./tests/query_tests.rs:48:9
   5: query_tests::test_group_by_nullable
             at ./tests/query_tests.rs:817:5
   6: query_tests::test_group_by_nullable::{{closure}}
             at ./tests/query_tests.rs:793:29
   7: core::ops::function::FnOnce::call_once
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/ops/function.rs:250:5
   8: core::ops::function::FnOnce::call_once
             at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

failures:
    test_group_by_nullable

test result: FAILED. 55 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.56s
aratz-lasa commented 7 months ago

The specific test causing the overflow is this: https://github.com/cswinter/LocustDB/blob/bc86bc950f7293a2220fcac09bfd9741b41adf8a/tests/query_tests.rs#L818

cswinter commented 7 months ago

yeah this is a bit of a tricky bug, i think i might have fixed it since then on a branch i would recommend using the https://github.com/cswinter/LocustDB/tree/geistesblitz branch, it has a bunch of improvements and bug fixes (planning to merge it but not quite ready yet) and all tests should pass

aratz-lasa commented 7 months ago

Indeed, they all pass. Thank you.