Skip to content

Define VariantPath's grammar and compatibility target #11627

Description

@sdf-jkl

Is your feature request related to a problem or challenge?

We've referred to both Spark/Databricks paths and JSONPath while building
VariantPath, but haven't settled which behavior we're targeting when they differ.

Escaping is one example: Arrow reads ['a\nb'] as the key anb. Spark 4.2 and 4.3 keep the backslash and read a\nb. Spark master, targeting 4.4, reads \n as a newline (apache/spark#59097, merged as SPARK-59218), and spark.sql.legacy.variantPathBackslashAsLiteral restores the older behavior. Arrow also accepts \], which RFC 9535 rejects.

Describe the solution you'd like

Agree on the target and document the supported subset:

  • Should VariantPath follow Spark/Databricks, RFC 9535, or its existing behavior?
  • How should we handle accepted paths whose meaning would change?
  • Which extensions belong to specific consumers, such as [*] for shredding
    schemas versus singular paths for variant_get?

Capture the decision in a small compatibility table and tests, starting with
quotes and backslash escapes.

Describe alternatives you've considered

Keep the current grammar and document its differences. That's also a valid
choice; the goal is to make future parsing decisions consistent.

Additional context

Activity

  1. added
    enhancement
    on Oct 16, 2026
  2. cakeni commented on Oct 17, 2026

    @cakeni
    Contributor

    I'd document the current grammar as the default and make Spark/RFC escape decoding an explicit mode if we decide to add it, since changing ['a\nb'] would silently select a different key. A compatibility test should put both anb and a\nb (with an actual newline) in the same object so it catches a meaning change, rather than only checking that parsing succeeds. For [*], I'd keep the existing consumer split: VariantPath represents it, variant_get rejects it, and shredding treats it as an element-schema selector.

  3. sdf-jkl commented on Oct 30, 2026

    @sdf-jkl
    MemberAuthor

    I want to avoid

    Image

    And adopt an existing format, so keeping the existing behavior as is does not seem like a good idea to me 🤷

  4. sdf-jkl commented on Nov 10, 2026

    @sdf-jkl
    MemberAuthor

    Unify Variant string-path syntax with Spark, rather than retaining both Spark-rooted paths and Arrow-style rootless paths.

    Maybe we should update arrow-rs to follow spark style?

    Originally posted by @alamb in #166

    makes me inclined to follow spark

  5. alamb commented on Nov 12, 2026

    @alamb
    Contributor

    👍

  6. added a commit that references this issue on Nov 19, 2026
    8e2f379
  7. reopened this on Nov 19, 2026
  8. alamb commented on Nov 19, 2026

    @alamb
    Contributor

    We got carried away and had to revert this for 60 -- will target 61. See #12247

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions