horaedb icon indicating copy to clipboard operation
horaedb copied to clipboard

Occurs `attempt to subtract with overflow` panic

Open chunshao90 opened this issue 2 years ago • 2 comments

Describe this problem

2022-09-13 15:34:34.136 ERRO [common_util/src/panic.rs:40] thread 'cse-read' panicked 'attempt to subtract with overflow' at "/rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/ops/arith.rs:215"
   0: common_util::panic::set_panic_hook::{{closure}}
             at /app/ceresdb/ceresdbx/common_util/src/panic.rs:39:18
   1: std::panicking::rust_panic_with_hook
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:610:17
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:500:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/sys_common/backtrace.rs:139:18
   4: rust_begin_unwind
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:498:5
   5: core::panicking::panic_fmt
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/panicking.rs:107:14
   6: core::panicking::panic
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/panicking.rs:48:5
   7: <u64 as core::ops::arith::Sub>::sub
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/ops/arith.rs:208:45
      arrow::compute::kernels::arithmetic::subtract::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/arrow-7.0.0/src/compute/kernels/arithmetic.rs:1030:40
      arrow::compute::kernels::arithmetic::math_op::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/arrow-7.0.0/src/compute/kernels/arithmetic.rs:183:23
      core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/ops/function.rs:280:13
      core::option::Option<T>::map
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/option.rs:883:29
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/adapters/map.rs:103:9
      arrow::buffer::mutable::MutableBuffer::from_trusted_len_iter
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/arrow-7.0.0/src/buffer/mutable.rs:440:21
      arrow::buffer::immutable::Buffer::from_trusted_len_iter
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/arrow-7.0.0/src/buffer/immutable.rs:278:9
      arrow::compute::kernels::arithmetic::math_op
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/arrow-7.0.0/src/compute/kernels/arithmetic.rs:189:27
      arrow::compute::kernels::arithmetic::subtract
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/arrow-7.0.0/src/compute/kernels/arithmetic.rs:1030:12
   8: datafusion::physical_plan::expressions::binary::BinaryExpr::evaluate_with_resolved_args
             at /root/.cargo/git/checkouts/arrow-datafusion-78dc86050a92b8a7/3e88f02/datafusion/src/physical_plan/expressions/binary.rs:992:32
   9: <datafusion::physical_plan::expressions::binary::BinaryExpr as datafusion::physical_plan::PhysicalExpr>::evaluate
             at /root/.cargo/git/checkouts/arrow-datafusion-78dc86050a92b8a7/3e88f02/datafusion/src/physical_plan/expressions/binary.rs:876:9
  10: <datafusion::physical_plan::expressions::nth_value::NthValue as datafusion::physical_plan::window_functions::BuiltInWindowFunctionExpr>::create_evaluator::{{closure}}
             at /root/.cargo/git/checkouts/arrow-datafusion-78dc86050a92b8a7/3e88f02/datafusion/src/physical_plan/expressions/nth_value.rs:127:22
      core::iter::adapters::map::map_try_fold::{{closure}}
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/adapters/map.rs:91:28
      core::iter::traits::iterator::Iterator::try_fold
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/traits/iterator.rs:1995:21
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/adapters/map.rs:117:9
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/adapters/map.rs:117:9
  11: <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/adapters/mod.rs:178:9
      core::iter::traits::iterator::Iterator::find
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/traits/iterator.rs:2463:9
      <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/adapters/mod.rs:160:9
      <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/alloc/src/vec/spec_from_iter_nested.rs:23:32
      <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/alloc/src/vec/spec_from_iter.rs:33:9
  12: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/alloc/src/vec/mod.rs:2551:9
      core::iter::traits::iterator::Iterator::collect
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/traits/iterator.rs:1745:9
      <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/result.rs:1972:53
      core::iter::adapters::process_results
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/adapters/mod.rs:149:17
  13: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/result.rs:1972:9
      core::iter::traits::iterator::Iterator::collect
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/iter/traits/iterator.rs:1745:9
      datafusion::physical_plan::projection::ProjectionStream::batch_project
             at /root/.cargo/git/checkouts/arrow-datafusion-78dc86050a92b8a7/3e88f02/datafusion/src/physical_plan/projection.rs:239:9
  14: <datafusion::physical_plan::projection::ProjectionStream as futures_core::stream::Stream>::poll_next::{{closure}}
             at /root/.cargo/git/checkouts/arrow-datafusion-78dc86050a92b8a7/3e88f02/datafusion/src/physical_plan/projection.rs:267:37
      core::task::poll::Poll<T>::map
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/task/poll.rs:52:43
  15: <datafusion::physical_plan::projection::ProjectionStream as futures_core::stream::Stream>::poll_next
             at /root/.cargo/git/checkouts/arrow-datafusion-78dc86050a92b8a7/3e88f02/datafusion/src/physical_plan/projection.rs:266:20
  16: <table_engine::stream::FromDfStream as futures_core::stream::Stream>::poll_next
             at /app/ceresdb/ceresdbx/table_engine/src/stream.rs:107:15
  17: <core::pin::Pin<P> as futures_core::stream::Stream>::poll_next
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/futures-core-0.3.16/src/stream.rs:120:9
      <S as futures_core::stream::TryStream>::try_poll_next
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/futures-core-0.3.16/src/stream.rs:196:9
      <futures_util::stream::try_stream::try_collect::TryCollect<St,C> as core::future::future::Future>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/futures-util-0.3.16/src/stream/try_stream/try_collect.rs:46:26
  18: query_engine::executor::collect::{{closure}}
             at /app/ceresdb/ceresdbx/query_engine/src/executor.rs:135:25
      <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/future/mod.rs:84:19
      <query_engine::executor::ExecutorImpl as query_engine::executor::Executor>::execute_logical_plan::{{closure}}
             at /app/ceresdb/ceresdbx/query_engine/src/executor.rs:105:45
      <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/future/mod.rs:84:19
  19: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/future/future.rs:123:9
      <interpreters::select::SelectInterpreter<T> as interpreters::interpreter::Interpreter>::execute::{{closure}}
             at /app/ceresdb/ceresdbx/interpreters/src/select.rs:61:52
      <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/future/mod.rs:84:19
  20: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/future/future.rs:123:9
      server::grpc::query::fetch_query_output::{{closure}}
             at /app/ceresdb/ceresdbx/server/src/grpc/query.rs:146:19
      <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/future/mod.rs:84:19
  21: server::grpc::query::handle_query::{{closure}}
             at /app/ceresdb/ceresdbx/server/src/grpc/query.rs:44:54
      <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/future/mod.rs:84:19
      <server::grpc::StorageServiceImpl<C,Q> as ceresdbxproto::protos::storage_grpc::StorageService>::query::{{closure}}
             at /app/ceresdb/ceresdbx/server/src/grpc/mod.rs:431:61
      <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/future/mod.rs:84:19
  22: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/futures-util-0.3.16/src/future/future/map.rs:55:37
  23: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/futures-util-0.3.16/src/lib.rs:95:13
      <futures_util::future::future::flatten::Flatten<Fut,<Fut as core::future::future::Future>::Output> as core::future::future::Future>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/futures-util-0.3.16/src/future/future/flatten.rs:50:36
  24: <futures_util::future::future::Then<Fut1,Fut2,F> as core::future::future::Future>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/futures-util-0.3.16/src/lib.rs:95:13
      tokio::runtime::task::core::CoreStage<T>::poll::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/core.rs:161:17
      tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/loom/std/unsafe_cell.rs:14:9
      tokio::runtime::task::core::CoreStage<T>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/core.rs:151:13
      tokio::runtime::task::harness::poll_future::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/harness.rs:461:19
      <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/panic/unwind_safe.rs:271:9
      std::panicking::try::do_call
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:406:40
      std::panicking::try
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:370:19
  25: std::panic::catch_unwind
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panic.rs:133:14
      tokio::runtime::task::harness::poll_future
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/harness.rs:449:18
  26: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/harness.rs:98:27
      tokio::runtime::task::harness::Harness<T,S>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/harness.rs:53:15
  27: tokio::runtime::task::raw::RawTask::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/raw.rs:70:18
      tokio::runtime::task::LocalNotified<S>::run
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/mod.rs:343:9
      tokio::runtime::thread_pool::worker::Context::run_task::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/thread_pool/worker.rs:443:21
      tokio::coop::with_budget::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/coop.rs:102:9
      std::thread::local::LocalKey<T>::try_with
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/thread/local.rs:412:16
      std::thread::local::LocalKey<T>::with
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/thread/local.rs:388:9
  28: tokio::coop::with_budget
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/coop.rs:95:5
      tokio::coop::budget
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/coop.rs:72:5
      tokio::runtime::thread_pool::worker::Context::run_task
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/thread_pool/worker.rs:419:9
  29: tokio::runtime::thread_pool::worker::Context::run
  30: tokio::runtime::thread_pool::worker::run::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/thread_pool/worker.rs:371:17
      tokio::macros::scoped_tls::ScopedKey<T>::set
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/macros/scoped_tls.rs:61:9
  31: tokio::runtime::thread_pool::worker::run
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/thread_pool/worker.rs:368:5
  32: tokio::runtime::thread_pool::worker::Launch::launch::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/thread_pool/worker.rs:347:45
      <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/blocking/task.rs:42:21
  33: tokio::runtime::task::core::CoreStage<T>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/core.rs:151:13
      tokio::runtime::task::harness::poll_future::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/harness.rs:461:19
      <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/panic/unwind_safe.rs:271:9
      std::panicking::try::do_call
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:406:40
      std::panicking::try
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:370:19
      std::panic::catch_unwind
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panic.rs:133:14
      tokio::runtime::task::harness::poll_future
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/harness.rs:449:18
      tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/harness.rs:98:27
      tokio::runtime::task::harness::Harness<T,S>::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/harness.rs:53:15
  34: tokio::runtime::task::raw::RawTask::poll
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/raw.rs:70:18
      tokio::runtime::task::UnownedTask<S>::run
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/task/mod.rs:379:9
      tokio::runtime::blocking::pool::Inner::run
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/blocking/pool.rs:264:17
  35: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}
             at /root/.cargo/registry/src/gitlab.alipay-inc.com-bfbf2811318eff5d/tokio-1.15.0/src/runtime/blocking/pool.rs:244:17
      std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/sys_common/backtrace.rs:123:18
  36: std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/thread/mod.rs:477:17
      <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/panic/unwind_safe.rs:271:9
      std::panicking::try::do_call
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:406:40
      std::panicking::try
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panicking.rs:370:19
      std::panic::catch_unwind
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/panic.rs:133:14
      std::thread::Builder::spawn_unchecked::{{closure}}
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/thread/mod.rs:476:30
      core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/core/src/ops/function.rs:227:5
  37: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/alloc/src/boxed.rs:1854:9
      <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/alloc/src/boxed.rs:1854:9
      std::sys::unix::thread::Thread::new::thread_start
             at /rustc/f1ce0e6a00593493a12e0e3662119786c761f375/library/std/src/sys/unix/thread.rs:108:17
  38: start_thread
  39: __clone

Steps to reproduce

SQL is :

select count(DISTINCT hostname) - count(DISTINCT concat(graphId, hostname)) as 'value' from xx where gmtCreate >= '2022-09-13 00:00:00' and gmtCreate < '2022-09-14 00:00:00'

Refer to https://github.com/apache/arrow-rs/pull/2643, this pr has already fixed it, we need to bump to the latest version.

Expected behavior

No response

Additional Information

No response

chunshao90 avatar Sep 14 '22 06:09 chunshao90

I reproduced this bug; firstly, I create table 'demo',

curl --location --request POST 'http://127.0.0.1:5440/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "CREATE TABLE `demo2` (`name` string TAG,`name1` string TAG, `value` uint64 NOT NULL, `t` timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE=Analytic with (enable_ttl='\''false'\'')"
}'

Then,insert two record

curl --location --request POST 'http://127.0.0.1:5440/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "INSERT INTO demo2(t, name,name1, value) VALUES(1651737067000, '\''ceresdb'\'','\''ceresdb0'\'', 100)"
}'
curl --location --request POST 'http://127.0.0.1:5440/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "INSERT INTO demo2(t, name,name1, value) VALUES(1651737067000, '\''ceresdb'\'','\''ceresdb1'\'', 99)"
}'

Finally, bug repeated with the sql :

curl --location --request POST 'http://127.0.0.1:5440/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "select min(value)-max(value) from demo2"
}'

MichaelLeeHZ avatar Sep 22 '22 11:09 MichaelLeeHZ

I reproduced this bug; firstly, I create table 'demo',

curl --location --request POST 'http://127.0.0.1:5440/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "CREATE TABLE `demo2` (`name` string TAG,`name1` string TAG, `value` uint64 NOT NULL, `t` timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE=Analytic with (enable_ttl='\''false'\'')"
}'

Then,insert two record

curl --location --request POST 'http://127.0.0.1:5440/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "INSERT INTO demo2(t, name,name1, value) VALUES(1651737067000, '\''ceresdb'\'','\''ceresdb0'\'', 100)"
}'
curl --location --request POST 'http://127.0.0.1:5440/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "INSERT INTO demo2(t, name,name1, value) VALUES(1651737067000, '\''ceresdb'\'','\''ceresdb1'\'', 99)"
}'

Finally, bug repeated with the sql :

curl --location --request POST 'http://127.0.0.1:5440/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "select min(value)-max(value) from demo2"
}'

Would you like to attach the stack trace of this panic? (The one in the issue description doesn't belong to the latest version).

ShiKaiWi avatar Sep 23 '22 02:09 ShiKaiWi