You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Variant] Support read-only metadata builders (#8208)
# Which issue does this PR close?
- Closes#8152
# Rationale for this change
When manipulating existing variant values (unshredding, removing fields,
etc), the metadata column is already defined and already contains all
necessary field ids. In fact, defining new/different field ids would
require rewriting the bytes of those already-encoded variant values. We
need a way to build variant values that rely on an existing metadata
dictionary.
# What changes are included in this PR?
* `MetadataBuilder` is now a trait, and most methods that work with
metadata builders now take `&mut dyn MetadataBuilder` instead of `&mut
MetadataBuilder`.
* The old `MetadataBuilder` struct is now `BasicMetadataBuilder` that
implements `MetadataBuilder`
* Define a `ReadOnlyMetadataBuilder` that wraps a `VariantMetadata` and
which also implements `MetadataBuilder`
* Update the `try_binary_search_range_by` helper method to be more
general, so we can define an efficient `VariantMetadata::get_entry` that
returns the field id for a given field name.
# Are these changes tested?
Existing tests cover the basic metadata builder. New tests added to
cover the read-only metadata builder.
# Are there any user-facing changes?
The renamed `BasicMetadataBuilder` (breaking), the new `MetadataBuilder`
trait (breaking), and the new `ReadOnlyMetadataBuilder`.
0 commit comments