MachaelLee opened a new issue, #4040:
URL: https://github.com/apache/arrow-datafusion/issues/4040

   **Describe the bug**
   Datafusion panic when I query `select app,count(distinct name) from `demo` 
group by app`.
   Here is the stacktrace:
   ```
   InvalidArgumentError("Column 'COUNT(DISTINCT demo.name)[count distinct]' is 
declared as non-nullable but contains null values")' at 
"/Users/michael/.cargo/git/checkouts/arrow-datafusion-b9eb4f789f8bda1f/d84ea9c/datafusion/core/src/physical_plan/repartition.rs:178"
      0: backtrace::backtrace::libunwind::trace
                at 
/Users/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.66/src/backtrace/mod.rs:66:5
         backtrace::backtrace::trace_unsynchronized
                at 
/Users/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.66/src/backtrace/mod.rs:66:5
         backtrace::backtrace::trace
                at 
/Users/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.66/src/backtrace/mod.rs:53:14
         backtrace::capture::Backtrace::create
                at 
/Users/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.66/src/capture.rs:176:9
         backtrace::capture::Backtrace::new
                at 
/Users/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.66/src/capture.rs:140:22
      1: common_util::panic::set_panic_hook::{{closure}}
                at common_util/src/panic.rs:41:18
      2: std::panicking::rust_panic_with_hook
                at 
/rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:702:17
      3: std::panicking::begin_panic_handler::{{closure}}
                at 
/rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:588:13
      4: std::sys_common::backtrace::__rust_end_short_backtrace
                at 
/rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/sys_common/backtrace.rs:138:18
      5: rust_begin_unwind
                at 
/rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:584:5
      6: core::panicking::panic_fmt
                at 
/rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/panicking.rs:142:14
      7: core::result::unwrap_failed
                at 
/rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/result.rs:1814:5
      8: core::result::Result<T,E>::unwrap
                at 
/rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/result.rs:1107:23
         datafusion::physical_plan::repartition::BatchPartitioner::partition
                at 
/Users/michael/.cargo/git/checkouts/arrow-datafusion-b9eb4f789f8bda1f/d84ea9c/datafusion/core/src/physical_plan/repartition.rs:178:33
      9: 
datafusion::physical_plan::repartition::RepartitionExec::pull_from_input::{{closure}}
                at 
/Users/michael/.cargo/git/checkouts/arrow-datafusion-b9eb4f789f8bda1f/d84ea9c/datafusion/core/src/physical_plan/repartition.rs:452:13
         <core::future::from_generator::GenFuture<T> as 
core::future::future::Future>::poll
                at 
/rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/future/mod.rs:91:19
   
   ```
   **To Reproduce**
   1. Create a table like this:
   ```
   CREATE TABLE `demo` (`name` string NULL, `value` double NOT NULL)
   ```
   2. Insert data 
   ```
   INSERT INTO demo(value) VALUES(100)
   ```
   3. Query like following statement, with Group-By and Count(DISTINCT) 
operator.
   ```
   select `t`, count(distinct name) from demo group by `t`
   ```
   **Expected behavior**
   Return a result, not panic
   
   **Additional context**
   If partition_num is set to more than 1,  the error is as above;  If 
partition_num is set to 1, error is as: #1623: 
https://github.com/apache/arrow-datafusion/issues/1623.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to