clintropolis commented on code in PR #19072:
URL: https://github.com/apache/druid/pull/19072#discussion_r2880070855
##########
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
+ * {@link #parseJsonPath(String)} fixing up any bugs encountered from bad
paths like '$..a' or '$.[0].a' from
+ * previously bugged versions of {@link #toNormalizedJsonPath(List)} and
should be kept in sync.
Review Comment:
done, called parameter `allowFixEmptyFieldsBadPaths` since it is pretty
specific on the bad paths it allows
--
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]