Skip to content

Panic when using array_agg #4080

@ZuoTiJia

Description

@ZuoTiJia

Describe the bug
Use the array_agg function, which results in panic

To Reproduce

DataFusion CLI v13.0.0
❯ select array_agg([1]);
thread 'thread 'tokio-runtime-workertokio-runtime-workerthread '' panicked at 'tokio-runtime-worker' panicked at '' panicked at 'called `Result::unwrap()` on an `Err` value: Internal("Empty iterator passed to ScalarValue::iter_to_array")called `Result::unwrap()` on an `Err` value: Internal("Empty iterator passed to ScalarValue::iter_to_array")', ', .cargo/registry/src/github.com-1ecc6299db9ec823/datafusion-common-13.0.0/src/scalar.rs.cargo/registry/src/github.com-1ecc6299db9ec823/datafusion-common-13.0.0/src/scalar.rs::16081608::thread 'called `Result::unwrap()` on an `Err` value: Internal("Empty iterator passed to ScalarValue::iter_to_array")1818

', tokio-runtime-worker' panicked at '.cargo/registry/src/github.com-1ecc6299db9ec823/datafusion-common-13.0.0/src/scalar.rsnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-workercalled `Result::unwrap()` on an `Err` value: Internal("Empty iterator passed to ScalarValue::iter_to_array"):1608', :18' panicked at '
called `Result::unwrap()` on an `Err` value: Internal("Empty iterator passed to ScalarValue::iter_to_array") .cargo/registry/src/github.com-1ecc6299db9ec823/datafusion-common-13.0.0/src/scalar.rs', :.cargo/registry/src/github.com-1ecc6299db9ec823/datafusion-common-13.0.0/src/scalar.rs1608::160818:
18
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Internal("Empty iterator passed to ScalarValue::iter_to_array")', .cargo/registry/src/github.com-1ecc6299db9ec823/datafusion-common-13.0.0/src/scalar.rs:1608:18
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Internal("Empty iterator passed to ScalarValue::iter_to_array")', .cargo/registry/src/github.com-1ecc6299db9ec823/datafusion-common-13.0.0/src/scalar.rs:1608:18
+---------------------+
| ARRAYAGG(List([1])) |
+---------------------+
| [[1]]               |
+---------------------+
1 row in set. Query took 0.004 seconds.
❯

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions