Skip to content

new_null_array panics when constructing a struct of a dictionary #7571

@danking

Description

@danking

Describe the bug

        new_null_array(
            &DataType::Struct(Fields::from(vec![Field::new(
                "non_nullable_deeper_inner",
                DataType::Dictionary(Box::new(DataType::Utf8), Box::new(DataType::Int32)),
                false,
            )])),
            1,
        );
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f8a913b1381e90379c7ca63ac2b88b9518936628/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /rustc/f8a913b1381e90379c7ca63ac2b88b9518936628/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /rustc/f8a913b1381e90379c7ca63ac2b88b9518936628/library/core/src/panicking.rs:145:5
   3: core::option::unwrap_failed
             at /rustc/f8a913b1381e90379c7ca63ac2b88b9518936628/library/core/src/option.rs:2015:5
   4: core::option::Option<T>::unwrap
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:978:21
   5: arrow_data::data::ArrayData::new_null
             at /Users/danielking/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-data-55.0.0/src/data.rs:633:33
   6: arrow_data::data::ArrayData::new_null::{{closure}}
             at /Users/danielking/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-data-55.0.0/src/data.rs:628:34
   7: core::iter::adapters::map::map_fold::{{closure}}
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:88:28
   8: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::fold
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:255:27
   9: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:128:9
  10: core::iter::traits::iterator::Iterator::for_each
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:800:9
  11: alloc::vec::Vec<T,A>::extend_trusted
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3565:17
  12: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/spec_extend.rs:29:9
  13: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter_nested.rs:62:9
  14: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter.rs:34:9
  15: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3424:9
  16: core::iter::traits::iterator::Iterator::collect
             at /Users/danielking/.rustup/toolchains/nightly-2025-02-24-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:1971:9
  17: arrow_data::data::ArrayData::new_null
             at /Users/danielking/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-data-55.0.0/src/data.rs:626:21
  18: arrow_array::array::new_null_array
             at /Users/danielking/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arrow-array-55.0.0/src/array/mod.rs:867:16

To Reproduce
see above.
Expected behavior

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions