Repository navigation
bench(variant): add VariantPath parsing benchmark - #11508
Merged
Merged
Conversation
Covers dot notation, bracket fields, indexes, wildcards and escaped bracket fields so changes to the path parser can be measured. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DKER2
added a commit
to DKER2/arrow-rs
that referenced
this pull request
Oct 11, 2026
Moved to a separate PR (apache#11508) so the benchmark lands on main first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sdf-jkl
approved these changes
Oct 15, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 15, 2026
codewarnab
pushed a commit
to codewarnab/arrow-rs
that referenced
this pull request
Oct 27, 2026
# Which issue does this PR close? - Closes apache#9493. # Rationale for this change `parse_in_bracket` currently allocates a `String` for every bracket expression, including indexes, wildcards, and quoted fields that require no unescaping. `VariantPathElement::Field` already stores `Cow<str>`, so unescaped field names can borrow directly from the input path. # What changes are included in this PR? - Defer creation of the unescaped `String` until the first backslash is encountered. - Borrow the original bracket-content slice when no escape processing is required. - Preserve ownership for escaped fields and strip their surrounding quotes in place. - Add tests proving unescaped bracket fields use `Cow::Borrowed` while escaped fields use `Cow::Owned`. This branch includes `main` with apache#11231 (closing brackets inside quoted fields). The quote tracking added there relied on the eagerly built buffer, so it is adapted here: an opening quote is now detected by its offset in the bracket content rather than by the buffer being empty, and quoted fields containing `]` (e.g. `['a]b']`) still borrow. # Are these changes tested? Yes. The existing path parsing tests cover behavior, and a new test asserts the ownership of each case: empty, plain, and `]`-containing quoted fields are borrowed, and an escaped field is owned. The benchmark for this change is in apache#11508 (`cargo bench -p parquet-variant --bench variant_path`), split out as requested so it is available on `main` as a baseline. I will merge `main` here once it lands so the numbers can be reproduced. Earlier local measurements, taken with a temporary Criterion harness on aarch64 macOS before apache#11231 was merged in: | Case | Before | After | Change | |---|---:|---:|---:| | Three quoted bracket fields | 300.22 ns | 54.10 ns | -81.7% | | Three bracket indexes | 146.13 ns | 45.57 ns | -68.2% | | Escaped bracket field | 140.41 ns | 111.37 ns | -24.9% | | Dot-path control | 38.68 ns | 40.88 ns | Within noise | # Are there any user-facing changes? No semantic or public API changes. Parsed paths remain the same; unescaped bracket fields now borrow their names instead of allocating owned strings. # AI usage OpenAI Codex was used to inspect the parser, help implement the lazy allocation path, construct ownership tests, and run validation and benchmarks. Claude Code was used to adapt the change to apache#11231 after merging `main`. I reviewed the resulting code and behavior and can own and debug the change. --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Kosta Tarasov <[email protected]>
5 tasks
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
#11232 changes how
VariantPathstrings are parsed, and there is currently no benchmark covering path parsing. As requested in #11232 (comment), this adds the benchmark on its own so it is available onmainas a baseline before that PR proceeds.What changes are included in this PR?
A new Criterion target,
variant_path, inparquet-variant. It parses six path strings withVariantPath::try_from:dot_fieldsfoo.bar.bazbracket_quoted_fields['foo']['bar']['baz']bracket_indexes[0][1][2]bracket_wildcards[*][*][*]bracket_escaped_field['escaped\]field']mixeda['b.c'].d[2]['3']Run with
cargo bench -p parquet-variant --bench variant_path.For reference, results on
main(aarch64 macOS):dot_fieldsbracket_quoted_fieldsbracket_indexesbracket_wildcardsbracket_escaped_fieldmixedAre these changes tested?
This PR only adds a benchmark; no library code changes.
Are there any significant user-facing changes?
No.
AI usage
Claude Code was used to write the benchmark and run it. I reviewed the result and can own and debug the change.
🤖 Generated with Claude Code