maltzsama opened a new issue, #180:
URL: https://github.com/apache/arrow-swift/issues/180
### Describe the bug, including details regarding any error messages,
version, and platform.
### Description
`BaseBufferBuilder.isNull(_:)` reports a value as null when it is valid, and
as valid when it is null.
### Root Cause
The builders write a standard Arrow validity bitmap: `append` calls `setBit`
for non-null values and `clearBit` for null values, so a set bit means valid.
The function returns `isSet`, which means it reports the opposite of the
intended result.
```swift
public func isNull(_ index: UInt) -> Bool {
return self.nulls.length == 0 || BitUtility.isSet(index + self.offset,
buffer: self.nulls)
}
```
This is confirmed by two other places in the codebase that treat the same
bitmap correctly:
- `ArrowData.isNull(_:)` returns `nullBuffer.length > 0 &&
!BitUtility.isSet(...)`
- `ListBufferBuilder.isNull(_:)` returned `!BitUtility.isSet(...)`
(redundant override)
### Affected Builders
- `FixedBufferBuilder`
- `BoolBufferBuilder`
- `VariableBufferBuilder`
- `StructBufferBuilder`
- `Date32BufferBuilder` and `Date64BufferBuilder` (via
`AbstractWrapperBufferBuilder`)
### Impact
No code inside the library calls the builders' `isNull` — all internal
readers go through `ArrowData.isNull` — so this affects external users of the
public builder API only.
--
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]