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

fix: new_null_array for structs #736

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

bjchambers
Copy link
Contributor

@bjchambers bjchambers commented Sep 1, 2021

Which issue does this PR close?

Closes #734.

Rationale for this change

new_null_array should produce a valid array when used with DataType::Struct

What changes are included in this PR?

Previously failing, now passing test demonstrating that new_null_array returned a struct array with invalid lengths.

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Sep 1, 2021
.map(|field| ArrayData::new_empty(field.data_type()))
.collect(),
)),
.map(|field| (field.clone(), new_null_array(field.data_type(), length)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One concern I have is that this creates a new null array for the field even if the field was non-nullable. I think that is OK because the enclosing struct is null at all those points, but wasn't 100% sure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nevi-me is the expert here. I believe the nullability is passed from parent to child so your assumption is correct

@codecov-commenter
Copy link

Codecov Report

Merging #736 (5b1f69c) into master (34df13a) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #736      +/-   ##
==========================================
+ Coverage   82.47%   82.48%   +0.01%     
==========================================
  Files         168      168              
  Lines       47690    47701      +11     
==========================================
+ Hits        39330    39347      +17     
+ Misses       8360     8354       -6     
Impacted Files Coverage Δ
arrow/src/array/array.rs 83.63% <100.00%> (+2.40%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 34df13a...5b1f69c. Read the comment docs.

Copy link
Member

@jorgecarleitao jorgecarleitao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bjchambers !

@alamb alamb merged commit 5af340c into apache:master Sep 9, 2021
alamb pushed a commit that referenced this pull request Sep 9, 2021
alamb added a commit that referenced this pull request Sep 10, 2021
Co-authored-by: Ben Chambers <35960+bjchambers@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new_null_array creates invalid struct arrays
4 participants