apache / arrow-rs

Official Rust implementation of Apache Arrow
https://arrow.apache.org/
Apache License 2.0
2.62k stars 802 forks source link

[ffi] Fix arrow-array null_count error during conversion from C to Rust #6674

Closed adbmal closed 2 weeks ago

adbmal commented 2 weeks ago

Which issue does this PR close?

Closes #6497

Rationale for this change

What changes are included in this PR?

  1. Let FFI_ArrowArray null_count() function return Option<usize>, and return None if the value of null_count < 0.
  2. Pass FFI_ArrowArray null_count() to ArrayData 's null_count, which is also Option<usize>, ArrayData will initialize if value is None.
  3. Add UT to verify it.

Are there any user-facing changes?

No

adbmal commented 2 weeks ago

Hi, @tustvold , Thanks for your review. I follow your suggestion and updated the PR, please review it again, thanks.