[C++] Bitmap::VisitWordAndWrite epilogue needs to work on Words (not bytes)
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
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:
```java
// code placeholder
// N readers, M writers
int64_t bits_written = 0;
auto visitor = [&](std::array in, std::array* 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.
**Reporter**: [Niranda Perera](https://issues.apache.org/jira/browse/ARROW-13312) / @nirandaperera
**Note**: *This issue was originally created as [ARROW-13312](https://issues.apache.org/jira/browse/ARROW-13312). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*
Contributor guide
Research direction
Start with Bitmap::VisitWordAndWrite and trace its epilogue handling through BitmapWordReader and BitmapWordWriter. Add the named trailing-word functionality and have the epilogue invoke the visitor with words, then verify that trailing-byte processing counts bits correctly rather than treating each byte as a full Word.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100