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

[C++] Bitmap::VisitWordAndWrite epilogue needs to work on Words (not bytes)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • C++
    • None

    Description

      In recently added `Bitmap::VisitWordAndWrite` method, translates the `visitor` lambda (that works on a `Word`) to a byte-visitor while handling the epilogue.

      This could lead to incorrect results in the client code.

      ex:

      // code placeholder
      // N readers, M writers 
      int64_t bits_written = 0;
      auto visitor = [&](std::array<Word, N> in, std::array<Word, M>* out){
       ...
       bits_written += (sizeof(Word) * 8);
      }

      At the end of the Visit, bits_written would have an incorrect sum because in the prologue, it adds 64 to bits_written for each trailing byte, whereas it should've been 8.

       

      Possible solution:

      Needs to add ReadTrailingWord and WriteTrailingWord functionality to BitmapWordReader and BitmapWordWriter respectively and call visitor with the words in the epilogue.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            niranda Niranda Perera
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: