risingwavelabs / risingwave

Best-in-class stream processing, analytics, and management. Perform continuous analytics, or build event-driven applications, real-time ETL pipelines, and feature stores in minutes. Unified streaming and batch. PostgreSQL compatible.
https://go.risingwave.com/slack
Apache License 2.0
6.99k stars 575 forks source link

connector datagen: range overflow #4363

Closed tabVersion closed 2 years ago

tabVersion commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

a range overflow results in compute node crash

To Reproduce Steps to reproduce the behavior.

create materialized source s (v1 int, v2 float) with ( connector = 'datagen' ) row format json ;

Expected behavior None

Additional context

thread 'tokio-runtime-worker' panicked at 'Uniform::new_inclusive: range overflow', /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.5/src/distributions/uniform.rs:999:1
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9067d5277d10f0f32a49ec9c125a33828e26a32b/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/9067d5277d10f0f32a49ec9c125a33828e26a32b/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/9067d5277d10f0f32a49ec9c125a33828e26a32b/library/core/src/panicking.rs:48:5
   3: <rand::distributions::uniform::UniformFloat<f64> as rand::distributions::uniform::UniformSampler>::new_inclusive
             at /home/tab/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.5/src/distributions/uniform.rs:885:17
   4: <risingwave_common::types::ordered_float::impl_rand::UniformOrdered<f64> as rand::distributions::uniform::UniformSampler>::new_inclusive
             at ./src/common/src/types/ordered_float.rs:1000:36
   5: rand::distributions::uniform::UniformSampler::sample_single_inclusive
             at /home/tab/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.5/src/distributions/uniform.rs:299:29
   6: <core::ops::range::RangeInclusive<T> as rand::distributions::uniform::SampleRange<T>>::sample_single
             at /home/tab/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.5/src/distributions/uniform.rs:372:9
   7: rand::rng::Rng::gen_range
             at /home/tab/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.5/src/rng.rs:135:9
   8: <risingwave_common::field_generator::numeric::NumericFieldRandomConcrete<T> as risingwave_common::field_generator::NumericFieldRandomGenerator>::generate
             at ./src/common/src/field_generator/numeric.rs:95:22
   9: risingwave_common::field_generator::FieldGeneratorImpl::generate
             at ./src/common/src/field_generator/mod.rs:175:49
  10: risingwave_connector::source::datagen::source::generator::DatagenEventGenerator::next::{{closure}}::{{closure}}
             at ./src/connector/src/source/datagen/source/generator.rs:69:67
tabVersion commented 2 years ago

the bug is introduced in #3827 , adding support to datum breaks func to primitive types, f32 and f64