Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bjchambers opened this issue Nov 10, 2021 · 5 comments · Fixed by #942
Closed

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

bjchambers opened this issue Nov 10, 2021 · 5 comments · Fixed by #942
Assignees
Labels

Comments

@bjchambers
Copy link
Contributor

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.

@bjchambers bjchambers added the bug label Nov 10, 2021
@bjchambers
Copy link
Contributor Author

@alamb in case you have thoughts, since this looks to be in the new validation code.

@alamb
Copy link
Contributor

alamb commented Nov 10, 2021

@bjchambers sounds like a bug introduced in #810 -- are you planning to look at it, or shall I?

@bjchambers
Copy link
Contributor Author

I haven't looked into it much. If you're able that's great otherwise

I did see a comment near the failure that is suspicious (something about comparing length to length plus offset). But I'm not sure about the intended behavior.

@alamb
Copy link
Contributor

alamb commented Nov 10, 2021 via email

@alamb
Copy link
Contributor

alamb commented Nov 11, 2021

@bjchambers -- PR with proposed fix is #942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants