alamb commented on code in PR #12247:
URL: https://github.com/apache/arrow-rs/pull/12247#discussion_r4573872594


##########
parquet-variant/src/path.rs:
##########
@@ -14,15 +14,33 @@ use std::{borrow::Cow, ops::Deref};
 ///
 /// [`Variant::get_path`]: crate::Variant::get_path
 ///
-/// Create a [`VariantPath`] from a vector of [`VariantPathElement`], or
-/// from a single field name or index.
+/// Create a [`VariantPath`] from a vector of [`VariantPathElement`], from a
+/// single field name or index, or by parsing a path string.
+///
+/// # Path strings
+///
+/// [`VariantPath::try_from`] parses the paths that Spark's `variant_get`

Review Comment:
   it would be nice to link to docs of `variant_get` - 
https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_get
   
   It seems like it is "valid JSONPath" -- so maybe that would be a better way 
to describe this rather than spark:
   
   Something like
   
   > "parses JSONpath (link), the same as Spark's `variant_get` function (link)"



##########
parquet-variant/src/path.rs:
##########
@@ -43,37 +61,34 @@ use std::{borrow::Cow, ops::Deref};
 /// assert_eq!(path, path3);
 /// ```
 ///
-/// # Example: From Dot notation strings
+/// # Example: Path strings
 /// ```
-/// # use parquet_variant::{VariantPath, VariantPathElement};
-/// /// You can also convert strings directly into paths using dot notation
-/// let path = VariantPath::try_from("foo.bar.baz").unwrap();
-/// let expected = 
VariantPath::try_from("foo").unwrap().join("bar").join("baz");
+/// # use parquet_variant::{QuotedKeyEscapes, VariantPath, VariantPathElement};

Review Comment:
   I think it would help to:
   1. Start with a simpler example `$.a.b`
   2. Then work up to the more advanced example
   3. Keep the inline commentary



##########
parquet-variant/src/path.rs:
##########
@@ -43,37 +61,34 @@ use std::{borrow::Cow, ops::Deref};
 /// assert_eq!(path, path3);
 /// ```
 ///
-/// # Example: From Dot notation strings
+/// # Example: Path strings
 /// ```
-/// # use parquet_variant::{VariantPath, VariantPathElement};
-/// /// You can also convert strings directly into paths using dot notation
-/// let path = VariantPath::try_from("foo.bar.baz").unwrap();
-/// let expected = 
VariantPath::try_from("foo").unwrap().join("bar").join("baz");
+/// # use parquet_variant::{QuotedKeyEscapes, VariantPath, VariantPathElement};
+/// let path = VariantPath::try_from("$.a['b.c'].d[2]['3']").unwrap();

Review Comment:
   ```suggestion
   /// /// You can also convert strings directly into paths using dot notation
   /// let path = VariantPath::try_from("$.a['b.c'].d[2]['3']").unwrap();
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to