clintropolis commented on code in PR #16517:
URL: https://github.com/apache/druid/pull/16517#discussion_r1628457954


##########
processing/src/main/java/org/apache/druid/segment/StringDimensionIndexer.java:
##########
@@ -132,12 +142,14 @@ public EncodedKeyComponent<int[]> 
processRowValsToUnsortedEncodedKeyComponent(@N
     } else if (dimValues instanceof byte[]) {
       encodedDimensionValues =
           new 
int[]{dimLookup.add(emptyToNullIfNeeded(StringUtils.encodeBase64String((byte[]) 
dimValues)))};
+      dictionaryChanged = true;
     } else {
       encodedDimensionValues = new 
int[]{dimLookup.add(emptyToNullIfNeeded(dimValues))};
+      dictionaryChanged = true;
     }
 
     // If dictionary size has changed, the sorted lookup is no longer valid.
-    if (oldDictSize != dimLookup.size()) {
+    if (dictionaryChanged) {

Review Comment:
   >so that if its able to recall an earlier value that's actually very 
important ...this change will destroy the sortedLookup cache even in case all 
calls to add were hits.
   
   The lookup is only sorted when persisting a segment, so `add` shouldn't 
really happen after the dictionary is sorted. I would guess this is here as a 
safeguard.



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

Reply via email to