Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-2622

[C++] Array methods IsNull and IsValid are not complementary

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.9.0
    • 0.10.0
    • C++
    • None

    Description

      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:

      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);
      }
      

      Which leads to a situation where in the case of non-allocated bitmaps values are neither Null nor Valid. Shouldn't it rather be:

      bool IsValid(int64_t i) const {
        return null_bitmap_data_ == NULLPTR ||
          BitUtil::GetBit(null_bitmap_data_, i + data_->offset);
      }

      ?

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              buhrmann Thomas Buhrmann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: