You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2024/03/28 14:53:03 UTC

[I] [C#][Integration] Validity buffer comparison is dependent on zeroed final bits [arrow]

paleolimbot opened a new issue, #40870:
URL: https://github.com/apache/arrow/issues/40870

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   I ran across this when implementing integration tests for nanoarrow (), where I'd forgotten to zero the last few bits of each validity buffer when reading the testing integration JSON. This resulted in a failing check for nanoarrow -> C# because the check for validity buffer equivalence is just based on the bytes, not strictly the values of the relevant bits.
   
   I will fix the zeroed final byte for the purposes of ; however, I wonder if it is worth updating the bit of code that does this comparison since I don't believe there's any guarantee about the values of bits outside the range `[0, length]` in the bitmap.
   
   To double check this I at one point replaced:
   
   https://github.com/apache/arrow/blob/a9b2cc2c962f064c3fa5504909f122e9bcabda3f/csharp/test/Apache.Arrow.Tests/ArrowReaderVerifier.cs#L438-L441
   
   with
   
   ```csharp
                       ReadOnlySpan<byte> expectedSpan = expectedValidityBuffer.Span.Slice(0, validityBitmapByteCount);
                       ReadOnlySpan<byte> actualSpan = actualValidityBuffer.Span.Slice(0, validityBitmapByteCount);
   
                       for (int i = 0; i < arrayLength; i++)
                       {
                           Assert.True(
                               BitUtility.GetBit(expectedSpan, i) == BitUtility.GetBit(actualSpan, i),
                               string.Format("bit at index {0}/{1} is not equal", i, arrayLength));
                       }
   ```
   
   I'm happy to give this PR a shot if that is an acceptable change!
   
   ### Component(s)
   
   C#, Integration


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C#][Integration] Validity buffer comparison is dependent on zeroed final bits [arrow]

Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher commented on issue #40870:
URL: https://github.com/apache/arrow/issues/40870#issuecomment-2025434817

   It seems fine to me. If we were concerned about performance we could always byte compare the first validityBitmapByteCount-1 bytes directly and only the last byte in a bitwise fashion, but I can't imagine it would matter much in test code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C#][Integration] Validity buffer comparison is dependent on zeroed final bits [arrow]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on issue #40870:
URL: https://github.com/apache/arrow/issues/40870#issuecomment-2025914084

   Issue resolved by pull request 40873
   https://github.com/apache/arrow/pull/40873


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C#][Integration] Validity buffer comparison is dependent on zeroed final bits [arrow]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on issue #40870:
URL: https://github.com/apache/arrow/issues/40870#issuecomment-2025470585

   That makes sense...I'll put a PR together 🙂 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C#][Integration] Validity buffer comparison is dependent on zeroed final bits [arrow]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot closed issue #40870: [C#][Integration] Validity buffer comparison is dependent on zeroed final bits
URL: https://github.com/apache/arrow/issues/40870


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org