-
Notifications
You must be signed in to change notification settings - Fork 819
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
StructArray::from panics when passed empty vector #1657
Comments
I guess perhaps this is reasonable, since without their being at least one array it would be impossible to know the length of the struct array to create. |
I think having it just create a 0 length array would be sensible and avoid surprise panics. There are niche use-cases where a non-zero row count may be desirable, see #1536, but I think we can deal with that as needed? |
I'm also seeing this with
Then users who have to handle the non-zero length array of 0 fields would be able to call |
I think you could get away with a simpler signature, such as
But yes that makes sense to me, I hadn't thought of the null use-case |
I think the issue with just creating it of length |
I think this is closed by #4064 |
Describe the bug
StructArray::from(vec![])
causes a panic because it tries to index into the list of arrays to check their lengths here https://github.com/apache/arrow-rs/blob/master/arrow/src/array/array_struct.rs#L212.To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: