Jackie-Jiang commented on code in PR #15685:
URL: https://github.com/apache/pinot/pull/15685#discussion_r2101356196
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/realtime/impl/json/MutableJsonIndexImpl.java:
##########
@@ -117,9 +131,15 @@ private void addFlattenedRecords(List<Map<String, String>>
records) {
for (Map.Entry<String, String> entry : record.entrySet()) {
// Put both key and key-value into the posting list. Key is useful for
checking if a key exists in the json.
String key = entry.getKey();
- _postingListMap.computeIfAbsent(key, k -> new
RoaringBitmap()).add(_nextFlattenedDocId);
+ _postingListMap.computeIfAbsent(key, k -> {
+ _bytesSize += Utf8.encodedLength(key);
Review Comment:
It is looping over all characters in a string, which is not very cheap.
Given we are just getting a rough estimate (not even including the bitmap),
maybe just use `.length()`?
--
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]