itschrispeck commented on code in PR #12466: URL: https://github.com/apache/pinot/pull/12466#discussion_r1520649238
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/json/ImmutableJsonIndexReader.java: ########## @@ -309,12 +242,21 @@ private int getDocId(int flattenedDocId) { @Override public Map<String, RoaringBitmap> getMatchingDocsMap(String key) { Map<String, RoaringBitmap> matchingDocsMap = new HashMap<>(); + Pair<String, MutableRoaringBitmap> result = processArrayIndex(key); + key = result.getLeft(); + MutableRoaringBitmap arrayIndexFlattenDocIds = result.getRight(); + if (arrayIndexFlattenDocIds != null && arrayIndexFlattenDocIds.isEmpty()) { + return matchingDocsMap; + } int[] dictIds = getDictIdRangeForKey(key); - for (int dictId = dictIds[0]; dictId < dictIds[1]; dictId++) { // get docIds from posting list, convert these to the actual docIds ImmutableRoaringBitmap flattenedDocIds = _invertedIndex.getDocIds(dictId); - PeekableIntIterator it = flattenedDocIds.getIntIterator(); + PeekableIntIterator it = arrayIndexFlattenDocIds == null ? flattenedDocIds.getIntIterator() + : intersect(arrayIndexFlattenDocIds.clone(), flattenedDocIds); Review Comment: How about `MutableRoaringBitmap.and(arrayIndexFlattenDocIds, flattenedDocIds)`? -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org