You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Niranda Perera (Jira)" <ji...@apache.org> on 2021/07/12 17:20:00 UTC

[jira] [Updated] (ARROW-13312) [C++] Bitmap::VisitWordAndWrite epilogue needs to work on Words (not bytes)

     [ https://issues.apache.org/jira/browse/ARROW-13312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niranda Perera updated ARROW-13312:
-----------------------------------
    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:java}
// 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);
}{code}
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 prologue.

 

 

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

This could lead to incorrect results in the client code.

ex:
{code:java}
// 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);
}{code}
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 prologue.

 

 


> [C++] Bitmap::VisitWordAndWrite epilogue needs to work on Words (not bytes)
> ---------------------------------------------------------------------------
>
>                 Key: ARROW-13312
>                 URL: https://issues.apache.org/jira/browse/ARROW-13312
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Niranda Perera
>            Priority: Major
>
> 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:java}
> // 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);
> }{code}
> 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 prologue.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)