Skip to content

Commit 374a42f

Browse files
committed
Panic UnsafeAppendBoolToBitmap for dictionary and REE builders
For more context: https://github.com/apache/arrow-go/pull/558/changes#r2758798540 This commit makes `UnsafeAppendBoolToBitmap()` for `dictionaryBuilder` and `RunEndEncodedBuilder` panic. The current implementation pulled from `arrow/array/builder.go` would leave the builders in invalid states that would panic when trying to finish a record batch.
1 parent a6c0a5e commit 374a42f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

arrow/array/dictionary.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,10 @@ func (b *dictionaryBuilder) AppendEmptyValues(n int) {
646646
}
647647
}
648648

649+
func (b *dictionaryBuilder) UnsafeAppendBoolToBitmap(v bool) {
650+
panic("Calling UnsafeAppendBoolToBitmap on dictionaryBuilder would leave it in inconsistent state. Use AppendIndices instead.")
651+
}
652+
649653
func (b *dictionaryBuilder) Reserve(n int) {
650654
b.idxBuilder.Reserve(n)
651655
}

arrow/array/encoded.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ func (b *RunEndEncodedBuilder) AppendNulls(n int) {
398398
}
399399
}
400400

401+
func (b *RunEndEncodedBuilder) UnsafeAppendBoolToBitmap(v bool) {
402+
panic("Calling UnsafeAppendBoolToBitmap on a run-end encoded array is semantically undefined.")
403+
}
404+
401405
func (b *RunEndEncodedBuilder) NullN() int {
402406
return UnknownNullCount
403407
}

0 commit comments

Comments
 (0)