Skip to content

Replace DynVarBinBuilder with a generic VarBinBuilder - #9096

Open
robert3005 wants to merge 1 commit into
developfrom
rk/varbin-builder-trait
Open

Replace DynVarBinBuilder with a generic VarBinBuilder#9096
robert3005 wants to merge 1 commit into
developfrom
rk/varbin-builder-trait

Conversation

@robert3005

@robert3005 robert3005 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

DynVarBinBuilder was unncessary but through all of builder migrations we have made VarBinBuilder not an actual ArrayBuilder. This pr fixes VarBinBuilder builder behaviour and replaces all usages of DynVarBinBuilder with appropriate downcast of VarBinBuilder. After #9053 VarBinBuilder offsets should be constrainted to the same bound

`VarBinBuilder<O>` becomes an actual `ArrayBuilder`, carrying its own `DType`
and offset width, so `DynVarBinBuilder` is no longer needed as a separate
type-erasing wrapper.

Encodings recover the concrete offset width from a `&mut dyn ArrayBuilder`
with the new `match_each_varbin_builder!` (i32/i64) and
`match_each_any_varbin_builder!` (every width) macros, which monomorphize the
append body over the width instead of dispatching through `dyn`. The existing
`append_to_builder` specializations for FSST, OnPair and Zstd are ported over
mechanically; their optimizations follow in later commits.

Because the builder's offset type now matches the Arrow target, the Arrow byte
export hands the offsets buffer straight to Arrow with no cast, which also
removes the `VarBinView` + `arrow_cast` round trip a `Utf8`/`Binary` dtype
mismatch used to take. A `Binary` source exported to `Utf8` instead validates
the bytes of its live values, skipping the extents of null slots that
`GenericByteArray::try_new` would have rejected.

Also adds `BinaryView::bytes`, which borrows from already-resolved buffer
slices instead of cloning a buffer handle per row.

Signed-off-by: Robert Kruszewski <robert@spiraldb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant