Repository navigation
Conversation
…iant_get For a path of field names over unshredded `BinaryView` columns with a concrete output type, `variant_get` now finds each row's field directly in the encoded bytes. It builds a `Variant` only for the value it finds, instead of building and validating a `Variant` for every row and then walking the path through it. Other inputs keep the existing per-row path.
Contributor
Author
|
run benchmark variant_kernels env: |
|
🤖 Benchmark starting (GKE) | trigger Target: variant_kernels Sharding factor: 1 (1 workers). Comparing variant-get-field-fast-path (0f37956) to dfef34e (merge-base) diff Run configurationrun benchmark variant_kernels
env:
BENCH_FILTER: ^(variant_get|shred_variant)
shards: 1
Results will be posted when all workers finish. File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Target: variant_kernels Comparing variant-get-field-fast-path (0f37956) to dfef34e (merge-base) diff Run configurationrun benchmark variant_kernels
env:
BENCH_FILTER: ^(variant_get|shred_variant)
shards: 1
DetailsPer-runner informationvariant_kernels — shard 1/1Node: gk3-benchmark-cluster-nap-1tnnmms2-d85061fd-7fjk Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench variant_kernelsCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
Contributor
Author
|
superceded by #11511 |
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.
Which issue does this PR close?
Rationale for this change
For a path of field names over unshredded data,
variant_getbuilds aVariantfor every row, validates its metadata, value and object headers, and then walks the path through it. Most of that work serves fields that the lookup never reads. Rows that do not contain the requested field do all of it and produce a null.In a profile of
variant_get_unshredded_object_path_262k_rows, per-rowVariantconstruction and validation, per-row column downcasts, and the generic path walk take most of the time. The field lookup itself is a small part.What changes are included in this PR?
variant_field_lookup, finds a field by a path of names directly in the encoded metadata and value bytes. It reads only the headers it needs and the dictionary names that the binary search probes. It compares names as bytes. Every read is bounds-checked.variant_getuses it when the output type is concrete, the path has only field names, the target has notyped_value, and themetadataandvaluecolumns areBinaryView. It builds aVariantonly for the value found, and uses the existing row builder to convert it. Rows without the field append null and build nothing.Are these changes tested?
The existing
variant_gettests build their input withjson_to_variant, which producesBinaryViewcolumns. Thus the tests with field paths and typed output now run through the new path. The new module has unit tests for top-level and nested lookups, missing fields, non-object values, an empty path, agreement withVariantObject::getfor every field of a 300-field object, and truncated input.Benchmarks (
variant_kernels, local run, main vs this PR, three alternating runs):variant_get_unshredded_object_path_262k_rowsLocal run on an Apple Silicon laptop. No other
variant_kernelsbenchmark uses a field-name path. On real-world telemetry data with per-row metadata, we measuredvariant_geton unshredded object fields at 42–55% faster.Are there any significant user-facing changes?
No. One behavior difference: on the new path, malformed variant bytes produce an error, or a null under safe casting. The existing path panics in
Variant::newon malformed bytes.