Skip to content

Conversation

@klion26
Copy link
Member

@klion26 klion26 commented Jan 27, 2026

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Add [fieldName] support in VariantPath parser, will throw an error if the parser fails.

Also support escaping \ inside brackets. If we force users to use brackets when the field contains special characters, maybe we can also close #8954

Sample behaviors(read more on the code doc)

  • [foo] -> filed foo
  • [2] -> index 2
  • [a.b] -> field a.b
  • [a\]b] -> field a]b
  • [a\xb] -> field axb

Are these changes tested?

Added tests

Are there any user-facing changes?

Yes, there are some user-facing changes, but parquet-variant is still experient for now, so maybe we don't need to wait for a major version.

@github-actions github-actions bot added the parquet-variant parquet-variant* crates label Jan 27, 2026
@klion26 klion26 force-pushed the variant-path-field-in-bracket branch from 88e1964 to 3201b0e Compare January 27, 2026 08:50
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea looks good to me -- thank you @klion26

I think other than the term unchecked this PR looks reasonable to me

cc @scovich in case you have other thoughts


/// Parses a path string, panics on invalid input.
/// Only use for tests for known-valid input.
pub fn from_str_unchecked(s: &'a str) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In rust and other parts of this crate the "unchecked" word is often used to denote unsafe code -- specifically that could lead to undefined behavior

I suggest we don't call it "unchecked"

I think just from_str is probably fine ?

}

/// Create from &str with support for dot notation
impl<'a> From<&'a str> for VariantPath<'a> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking API (which is fine, I think, we should just make sure we have the API right this time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Variant] support .. and ['fieldName'] syntax in the VariantPath parser [Variant] Support escaping mechanism for VariantPath parsing

2 participants