siddharthteotia commented on code in PR #12223:
URL: https://github.com/apache/pinot/pull/12223#discussion_r1462871078


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/dictionary/DictionaryIndexType.java:
##########
@@ -308,7 +321,20 @@ public static Dictionary read(PinotDataBuffer dataBuffer, 
ColumnMetadata metadat
             : new BigDecimalDictionary(dataBuffer, length, numBytesPerValue);
       case STRING:
         numBytesPerValue = metadata.getColumnMaxLength();
-        return loadOnHeap ? new OnHeapStringDictionary(dataBuffer, length, 
numBytesPerValue)
+
+        // If interning is enabled, get the required interners.
+        FALFInterner<String> strInterner = null;
+        FALFInterner<byte[]> byteInterner = null;
+        Intern internConfig = indexConfig.getIntern();
+        if (internConfig != null && !internConfig.isDisabled()) {
+          Preconditions.checkState(loadOnHeap, "Interning is only supported 
for on-heap dictionaries.");
+          DictionaryInternerHolder internerHolder = 
DictionaryInternerHolder.getInstance();
+          strInterner = internerHolder.getStrInterner(internIdentifierStr, 
internConfig.getCapacity());
+          byteInterner = internerHolder.getByteInterner(internIdentifierStr, 
internConfig.getCapacity());
+          LOGGER.info("Enabling interning for dictionary column: {}", 
columnName);
+        }
+
+        return loadOnHeap ? new OnHeapStringDictionary(dataBuffer, length, 
numBytesPerValue, strInterner, byteInterner)

Review Comment:
   Should we not consider running the code between 325-335 only if the 
`loadOnHeap = true` ?



-- 
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

Reply via email to