gianm commented on code in PR #17460:
URL: https://github.com/apache/druid/pull/17460#discussion_r1844300287


##########
processing/src/main/java/org/apache/druid/segment/nested/DictionaryIdLookup.java:
##########
@@ -262,45 +231,73 @@ private void ensureStringDictionaryLoaded()
   private void ensureLongDictionaryLoaded()
   {
     if (longDictionary == null) {
-      longDictionaryFile = makeTempFile(name + 
ColumnSerializerUtils.LONG_DICTIONARY_FILE_NAME);
-      longBuffer = SerializerUtils.mapSerializer(longDictionaryFile, 
longDictionaryWriter);
-      longDictionary = FixedIndexed.read(longBuffer, TypeStrategies.LONG, 
ByteOrder.nativeOrder(), Long.BYTES).get();
-      // reset position
-      longBuffer.position(0);
+      final String fileName = ColumnSerializerUtils.getInternalFileName(
+          name,
+          ColumnSerializerUtils.LONG_DICTIONARY_FILE_NAME
+      );
+      longDictionaryFile = makeTempDir(fileName);
+      longBufferMapper = closer.register(
+          ColumnSerializerUtils.mapSerializer(longDictionaryFile, 
longDictionaryWriter, fileName)
+      );
+      try {
+        final ByteBuffer buffer = longBufferMapper.mapFile(fileName);

Review Comment:
   All of these seem to be assuming that there will be no secondary smoosh 
components. Is that a good assumption? Should it be checked? If this a common 
pattern: maybe add a `mapOnlyFile` to `SmooshFileMapper` that verifies that the 
mapped file is the only one?



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