Thomas Buhrmann created ARROW-2622:
--------------------------------------
Summary: [C++] Array methods IsNull and IsValid are not
complementary
Key: ARROW-2622
URL: https://issues.apache.org/jira/browse/ARROW-2622
Project: Apache Arrow
Issue Type: Bug
Components: C++
Affects Versions: 0.9.0
Reporter: Thomas Buhrmann
Hi, not sure if this is a bug or if I misinterpret the spec. According to the
latter, "Arrays having a 0 null count may choose to not allocate the null
bitmap". From this I'd infer that the statement also holds in the other
direction, i.e. non-allocated bitmaps imply a 0 null count. This would mean
that if a bitmap is not allocated, IsValid() should always return true. But at
the moment it's doing this:
{code:java}
bool IsNull(int64_t i) const {
return null_bitmap_data_ != NULLPTR &&
BitUtil::BitNotSet(null_bitmap_data_, i + data_->offset);
}
bool IsValid(int64_t i) const {
return null_bitmap_data_ != NULLPTR &&
BitUtil::GetBit(null_bitmap_data_, i + data_->offset);
}
{code}
Which leads to a situation where in the case of non-allocated bitmaps values
are neither Null nor Valid. Shouldn't it rather be:
{code:java}
bool IsValid(int64_t i) const {
return null_bitmap_data_ == NULLPTR ||
BitUtil::GetBit(null_bitmap_data_, i + data_->offset);
}{code}
?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)