Skip to content

Validation error when manually copying array data for a slice array #940

@bjchambers

Description

@bjchambers

Describe the bug

The only commit in this branch https://github.com/bjchambers/arrow-rs/tree/reproduce-validation-error demonstrates the issue. See the added test https://github.com/bjchambers/arrow-rs/blob/reproduce-validation-error/arrow/src/array/data.rs#L1648 here.

Specifically, it creates a struct array, it slices it, then it gets all of the data from that array and attempts to create an identical array data. This fails in the validation due as follows:

thread 'array::data::tests::test_try_new_sliced_struct' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidArgumentError("Struct([Field { name: \"a\", data_type: Int32, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: None }, Field { name: \"b\", data_type: Boolean, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: None }]) child array #0 for field a has length smaller than expected for struct array (3 < 4)")', arrow/src/array/data.rs:1738:10
stack backtrace:

To Reproduce
Steps to reproduce the behavior:

Expected behavior
The array data can be constructed since it is a copy of existing (valid) data.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions