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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to