wirybeaver commented on code in PR #12466:
URL: https://github.com/apache/pinot/pull/12466#discussion_r1502008766
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/json/ImmutableJsonIndexReader.java:
##########
@@ -160,94 +161,26 @@ private MutableRoaringBitmap
getMatchingFlattenedDocIds(Predicate predicate) {
"Left-hand side of the predicate must be an identifier, got: %s (%s).
Put double quotes around the identifier"
+ " if needed.", lhs, lhs.getType());
String key = lhs.getIdentifier();
-
- MutableRoaringBitmap matchingDocIds = null;
+ // Support 2 formats:
+ // - JSONPath format (e.g. "$.a[1].b"='abc', "$[0]"=1, "$"='abc')
+ // - Legacy format (e.g. "a[1].b"='abc')
if (_version == BaseJsonIndexCreator.VERSION_2) {
- // Support 2 formats:
- // - JSONPath format (e.g. "$.a[1].b"='abc', "$[0]"=1, "$"='abc')
- // - Legacy format (e.g. "a[1].b"='abc')
- if (key.charAt(0) == '$') {
+ if (key.startsWith("$")) {
key = key.substring(1);
} else {
key = JsonUtils.KEY_SEPARATOR + key;
}
-
- // Process the array index within the key if exists
Review Comment:
Note: Keep the key preprocessing but move the generation of matchingDocIds
over array index json path to the static function processArrayIndex.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/realtime/impl/json/MutableJsonIndexImpl.java:
##########
@@ -209,41 +210,11 @@ private RoaringBitmap
getMatchingFlattenedDocIds(Predicate predicate) {
} else {
key = JsonUtils.KEY_SEPARATOR + key;
}
-
Review Comment:
Note: Move the processing of array index to the static function
processArrayIndex for code reusing
--
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]