itschrispeck commented on code in PR #11739: URL: https://github.com/apache/pinot/pull/11739#discussion_r1356140349
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/json/ImmutableJsonIndexReader.java: ########## @@ -300,6 +305,92 @@ private int getDocId(int flattenedDocId) { return _docIdMapping.getInt((long) flattenedDocId << 2); } + /** + * ImmutableJsonIndexReaderContext holds a cache that is used to accelerate following reads. The cache is specific + * to a key, and therefore should NOT be reused for other keys. For each key, ImmutableJsonIndexReader.createContext() + * should be invoked to create a fresh context. + */ + public static class ImmutableJsonIndexReaderContext implements JsonIndexReaderContext { + private final Int2ObjectOpenHashMap<RoaringBitmap> _cache; + + public ImmutableJsonIndexReaderContext() { + _cache = new Int2ObjectOpenHashMap<>(); + } + + public Int2ObjectOpenHashMap<RoaringBitmap> getCache() { + return _cache; + } + } + + @Override + public ImmutableJsonIndexReaderContext createContext() { + return new ImmutableJsonIndexReaderContext(); + } + + @Override + public String[] getValuesForKeyAndDocs(String key, int[] docIds, JsonIndexReaderContext context) { Review Comment: I think `key` is widely used in the code and this file to refer to a json key. I would prefer to maintain existing terminology jsonPath is generally used for `JsonPath` types from what I see. -- 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