DKER2 commented on code in PR #11232:
URL: https://github.com/apache/arrow-rs/pull/11232#discussion_r4389250699
##########
parquet-variant/src/path.rs:
##########
@@ -324,6 +324,32 @@ mod tests {
assert_eq!(path, expected);
}
+ #[test]
+ fn test_variant_path_bracket_field_ownership() {
+ let path =
VariantPath::try_from(r#"[""]["plain"]["escaped\]field"]"#).unwrap();
+
+ match &path[0] {
+ VariantPathElement::Field {
+ name: Cow::Borrowed(name),
+ } => assert_eq!(*name, ""),
+ other => panic!("expected borrowed field, got {other:?}"),
+ }
+
+ match &path[1] {
+ VariantPathElement::Field {
+ name: Cow::Borrowed(name),
+ } => assert_eq!(*name, "plain"),
+ other => panic!("expected borrowed field, got {other:?}"),
+ }
+
+ match &path[2] {
+ VariantPathElement::Field {
+ name: Cow::Owned(name),
+ } => assert_eq!(name, "escaped]field"),
+ other => panic!("expected owned field, got {other:?}"),
+ }
+ }
Review Comment:
Sorry for overlooking this one earlier @sdf-jkl - collapsed the four `match`
blocks into a single `matches!` like you suggested in 8ffc6b9ff.
--
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]