clintropolis commented on code in PR #19072:
URL: https://github.com/apache/druid/pull/19072#discussion_r2880080250
##########
processing/src/main/java/org/apache/druid/segment/nested/NestedPathFinder.java:
##########
@@ -173,7 +177,105 @@ public static List<NestedPathPart>
parseJsonPath(@Nullable String path)
badFormatJsonPath(path, "closing single-quote (') must immediately
precede ']'");
}
- parts.add(new NestedPathField(getPathSubstring(path, partMark, i)));
+ parts.add(new NestedPathField(path.substring(partMark, i)));
+ dotMark = -1;
+ quoteMark = -1;
+ // chomp to next char to eat closing array
+ if (++i == path.length()) {
+ break;
+ }
+ partMark = i + 1;
+ arrayMark = -1;
+ }
+ }
+ // add the last element, this should never be an array because they close
themselves
+ if (partMark < path.length()) {
+ if (quoteMark != -1) {
+ badFormatJsonPath(path, "unterminated single-quote (')");
+ }
+ if (arrayMark != -1) {
+ badFormatJsonPath(path, "unterminated '['");
+ }
+ parts.add(new NestedPathField(path.substring(partMark)));
+ }
+
+ return parts;
+ }
+
+ /**
+ * split a JSONPath path into a series of extractors to find things in
stuff. This method is mostly a duplicate of
Review Comment:
updated javadocs to be a bit clearer
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]