singhpratech opened a new pull request, #221:
URL: https://github.com/apache/arrow-swift/pull/221

   ## What's Changed
   
   The Arrow format allows a field with no nulls to omit its validity buffer, 
in which case it is written with length 0. `ArrowReader` gave such a buffer a 
non-zero `length` with no backing memory, so `ArrowData.isNull` read outside 
the allocation and returned arbitrary results.
   
   - Add `makeValidityBuffer` in `ArrowReaderHelper.swift` and use it in the 
struct, list, primitive and variable load paths. An omitted validity buffer now 
has length 0, which `ArrowData.isNull` already treats as "no nulls". This is 
the same convention `ArrowCImporter` uses for a null validity pointer.
   - Zero the padding that `ArrowBuffer.createBuffer(_:length:)` allocates up 
to the 64-byte aligned capacity, as the sibling `createBuffer(_:size:doAlign:)` 
already does.
   
   ## Testing
   
   - `testFileReader_absentValidityBuffer` reads `testdata_bool.arrow`, whose 
string column has no nulls and is written by arrow-go without a validity 
buffer. Without the fix this test fails: the column's rows are reported as null.
   - `testMakeValidityBuffer` covers both the absent and the present case, 
including the zeroed padding.
   - `swift test` passes locally on macOS with Swift 6.3, with the 
`-warnings-as-errors` flags enabled.
   
   Closes #186.


-- 
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