Source:
RowBasedKeySerde( final boolean includeTimestamp, final boolean sortByDimsFirst, final List<DimensionSpec> dimensions, final long maxDictionarySize, final DefaultLimitSpec limitSpec, final List<ValueType> valueTypes, @Nullable final List<String> dictionary ) { this.includeTimestamp = includeTimestamp; this.sortByDimsFirst = sortByDimsFirst; this.dimensions = dimensions; this.dimCount = dimensions.size(); this.valueTypes = valueTypes; this.limitSpec = limitSpec; this.enableRuntimeDictionaryGeneration = dictionary == null; this.dictionary = enableRuntimeDictionaryGeneration ? new ArrayList<>(DICTIONARY_INITIAL_CAPACITY) : dictionary; this.reverseDictionary = enableRuntimeDictionaryGeneration ? new Object2IntOpenHashMap<>(DICTIONARY_INITIAL_CAPACITY) : new Object2IntOpenHashMap<>(dictionary.size()); this.reverseDictionary.defaultReturnValue(UNKNOWN_DICTIONARY_KEY); this.maxDictionarySize = maxDictionarySize; this.serdeHelpers = makeSerdeHelpers(limitSpec != null, enableRuntimeDictionaryGeneration); this.keySize = (includeTimestamp ? Longs.BYTES : 0) + getTotalKeySize(); this.keyBuffer = ByteBuffer.allocate(keySize); if (!enableRuntimeDictionaryGeneration) { final long initialDictionarySize = dictionary.stream() .mapToLong(RowBasedGrouperHelper::estimateStringKeySize) .sum(); Preconditions.checkState( maxDictionarySize >= initialDictionarySize, "Dictionary size[%s] exceeds threshold[%s]", initialDictionarySize, maxDictionarySize ); for (int i = 0; i < dictionary.size(); i++) { reverseDictionary.put(dictionary.get(i), i); } initializeSortableIds(); } }

Target:
RowBasedKeySerde( final boolean includeTimestamp, final boolean sortByDimsFirst, final List<DimensionSpec> dimensions, final long maxDictionarySize, final DefaultLimitSpec limitSpec, final List<ValueType> valueTypes, @Nullable final List<String> dictionary ) { this.includeTimestamp = includeTimestamp; this.sortByDimsFirst = sortByDimsFirst; this.dimensions = dimensions; this.dimCount = dimensions.size(); this.valueTypes = valueTypes; this.limitSpec = limitSpec; this.enableRuntimeDictionaryGeneration = dictionary == null; this.dictionary = enableRuntimeDictionaryGeneration ? new ArrayList<>(DICTIONARY_INITIAL_CAPACITY) : dictionary; this.reverseDictionary = enableRuntimeDictionaryGeneration ? new Object2IntOpenHashMap<>(DICTIONARY_INITIAL_CAPACITY) : new Object2IntOpenHashMap<>(dictionary.size()); this.reverseDictionary.defaultReturnValue(UNKNOWN_DICTIONARY_ID); this.maxDictionarySize = maxDictionarySize; this.serdeHelpers = makeSerdeHelpers(limitSpec != null, enableRuntimeDictionaryGeneration); this.serdeHelperComparators = new BufferComparator[serdeHelpers.length]; Arrays.setAll(serdeHelperComparators, i -> serdeHelpers[i].getBufferComparator()); this.keySize = (includeTimestamp ? Longs.BYTES : 0) + getTotalKeySize(); this.keyBuffer = ByteBuffer.allocate(keySize); if (!enableRuntimeDictionaryGeneration) { final long initialDictionarySize = dictionary.stream() .mapToLong(RowBasedGrouperHelper::estimateStringKeySize) .sum(); Preconditions.checkState( maxDictionarySize >= initialDictionarySize, "Dictionary size[%s] exceeds threshold[%s]", initialDictionarySize, maxDictionarySize ); for (int i = 0; i < dictionary.size(); i++) { reverseDictionary.put(dictionary.get(i), i); } initializeRankOfDictionaryIds(); } }