Replace DynVarBinBuilder with a generic VarBinBuilder - #9096
Open
robert3005 wants to merge 1 commit into
Open
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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