Skip to content

[SQL] RuntimeError.WorkerPanic: '9223372036854775807 + 1' causes overflow for type BIGINT #5898

@wilmaontherun

Description

Environment:

Feldera running in docker
SQL
CREATE TABLE creative_bits (
row_id BIGINT,
a BIGINT,
b BIGINT,
payload VARCHAR
);

CREATE VIEW bm532_creative_try_math AS
SELECT
row_id,
a + b AS safe_sum,
CASE WHEN b = 0 OR b IS NULL THEN NULL ELSE CAST(a AS DOUBLE) / CAST(b AS DOUBLE) END AS safe_ratio,
COALESCE(a * 0, CAST(0 AS BIGINT)) AS safe_mul
FROM creative_bits;

-- Insert to trigger panic:
INSERT INTO creative_bits VALUES (1, 9223372036854775807, 1, 'test');

Reproduction summary
(from Claude using docker) I cannot reproduce on try.feldera.com

`Error Code: RuntimeError.WorkerPanic
HTTP Status: 500

Panic message: '9223372036854775807 + 1' causes overflow for type BIGINT
Panic location: /home/ubuntu/feldera/crates/sqllib/src/operators.rs:218:17

Stack trace:
0: dbsp::circuit::runtime::panic_hook
1: std::panicking::panic_with_hook
2: std::panicking::panic_handler::{{closure}}
3: std::sys::backtrace::__rust_end_short_backtrace
4: __rustc::rust_begin_unwind
5: core::panicking::panic_fmt
6: dbsp::mono::<impl dbsp::circuit::circuit_builder::Stream<dbsp::circuit::circuit_builder::ChildCircuit<(),()>,dbsp::typed_batch::TypedBatch<K,(),i64,dbsp::trace::ord::fallback::wset::FallbackWSet<dyn dbsp::dynamic::data::Data,dyn dbsp::dynamic::weight::WeightTyped+Type = i64>>>>::map::{{closure}}
7: <dbsp::operator::dynamic::filter_map::MapZSet<CI,CO> as dbsp::circuit::operator_traits::UnaryOperator<CI,CO>>::eval::{{closure}}
8: dbsp::circuit::operator_traits::UnaryOperator::eval_owned::{{closure}}
9: <dbsp::circuit::circuit_builder::UnaryNode<C,I,O,Op> as dbsp::circuit::circuit_builder::Node>::eval::{{closure}}
10: dbsp::circuit::schedule::dynamic_scheduler::Inner::spawn_task::{{closure}}
11: tokio::runtime::task::core::Core<T,S>::poll
12: tokio::runtime::task::harness::Harness<T,S>::poll
13: tokio::task::local::LocalSet::tick
14: std::thread::local::LocalKey::with
15: dbsp::circuit::circuit_builder::CircuitHandle::transaction::{{closure}}
16: tokio::runtime::context::scoped::Scoped::set
17: tokio::runtime::runtime::Runtime::block_on
18: dbsp::circuit::circuit_builder::CircuitHandle::transaction
19: std::sys::backtrace::__rust_end_short_backtrace
20: core::ops::function::FnOnce::call_once{{vtable.shim}}
21: std::sys::thread::unix::Thread::new::thread_start
22:
23: clone

Reproducer:

CREATE TABLE creative_bits (
row_id BIGINT,
a BIGINT,
b BIGINT,
payload VARCHAR
);

CREATE VIEW bm532_creative_try_math AS
SELECT
row_id,
a + b AS safe_sum,
CASE WHEN b = 0 OR b IS NULL THEN NULL ELSE CAST(a AS DOUBLE) / CAST(b AS DOUBLE) END AS safe_ratio,
COALESCE(a * 0, CAST(0 AS BIGINT)) AS safe_mul
FROM creative_bits;

-- Insert to trigger panic:
INSERT INTO creative_bits VALUES (1, 9223372036854775807, 1, 'test');

Root cause:
BIGINT arithmetic overflow (9223372036854775807 + 1) panics the worker thread
instead of returning NULL or raising a SQL-level error.
Spark handles this silently (returns NULL on overflow).`

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions