Commit a620957
authored
[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`.1 parent c83c6b2 commit a620957
File tree
5 files changed
+236
-44
lines changed- parquet-variant-compute/src
- parquet-variant/src
- variant
5 files changed
+236
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
0 commit comments