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

[C++] Array methods IsNull and IsValid is confused for NullType #28541

Closed
asfimport opened this issue May 17, 2021 · 1 comment
Closed

[C++] Array methods IsNull and IsValid is confused for NullType #28541

asfimport opened this issue May 17, 2021 · 1 comment

Comments

@asfimport
Copy link
Collaborator

asfimport commented May 17, 2021

I'm not sure if this is a bug or by design.

Array's method IsNull() and IsValid() is implemented as follows:

/// \brief Return true if value at index is null. Does not boundscheck
bool IsNull(int64_t i) const {
  return null_bitmap_data_ != NULLPTR &&
         !BitUtil::GetBit(null_bitmap_data_, i + data_->offset);
}

/// \brief Return true if value at index is valid (not null). Does not
/// boundscheck
bool IsValid(int64_t i) const {
  return null_bitmap_data_ == NULLPTR ||
         BitUtil::GetBit(null_bitmap_data_, i + data_->offset);
}

According to the doc, "Arrays having a 0 null count may choose to not allocate the null bitmap". But a null type array doesn't have a null bitmap. So for a null type array, IsNull() always returns false, IsValid() always returns true.

If this is by design, maybe additional comments and docs should be added.

Reporter: Chenxi Li / @Crystrix
Assignee: Nate Clark / @n3world

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-12804. Please see the migration documentation for further details.

@asfimport
Copy link
Collaborator Author

Antoine Pitrou / @pitrou:
Issue resolved by pull request 10756
#10756

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

No branches or pull requests

1 participant