saithal-confluent commented on code in PR #16517:
URL: https://github.com/apache/druid/pull/16517#discussion_r1625821371
##########
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:
Since the dimLookup.size() is quite expensive, as seen from the screenshot,
I've tried to remove that call by implicitly checking if the `add` to
`dimLookup` results in a change in the size of `dimLookup`.
You're right about the behavioural change. To keep the same behaviour, I've
pushed a commit which would now check if the result of `dimLookup.add()` with
`-1` and then set the boolean `dictionaryChanged` accordingly.
Please take a look @kgyrtkirk
--
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]