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.
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.
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:
appendcallssetBitfor non-null values andclearBitfor null values, so a set bit means valid. The function returnsisSet, which means it reports the opposite of the intended result.This is confirmed by two other places in the codebase that treat the same bitmap correctly:
ArrowData.isNull(_:)returnsnullBuffer.length > 0 && !BitUtility.isSet(...)ListBufferBuilder.isNull(_:)returned!BitUtility.isSet(...)(redundant override)Affected Builders
FixedBufferBuilderBoolBufferBuilderVariableBufferBuilderStructBufferBuilderDate32BufferBuilderandDate64BufferBuilder(viaAbstractWrapperBufferBuilder)Impact
No code inside the library calls the builders'
isNull— all internal readers go throughArrowData.isNull— so this affects external users of the public builder API only.