vibhatha commented on code in PR #38423:
URL: https://github.com/apache/arrow/pull/38423#discussion_r1424823464


##########
java/vector/src/main/java/org/apache/arrow/vector/ipc/ArrowFileWriter.java:
##########
@@ -130,14 +130,24 @@ protected void endInternal(WriteChannel out) throws 
IOException {
   protected void ensureDictionariesWritten(DictionaryProvider provider, 
Set<Long> dictionaryIdsUsed)
       throws IOException {
     if (dictionariesWritten) {
+      for (long id : dictionaryIdsUsed) {
+        BaseDictionary dictionary = provider.lookup(id);
+        if (dictionary.getEncoding().isDelta()) {
+          writeDictionaryBatch(dictionary, false);
+        } else if (dictionary.mark() > 0) {
+          throw new IllegalStateException("Replacement dictionaries are not 
supported in the " +
+              "IPC file format. Dictionary ID: " + 
dictionary.getEncoding().getId());
+        }
+      }
       return;
     }
+
     dictionariesWritten = true;
     // Write out all dictionaries required.
     // Replacement dictionaries are not supported in the IPC file format.
     for (long id : dictionaryIdsUsed) {
-      Dictionary dictionary = provider.lookup(id);
-      writeDictionaryBatch(dictionary);
+      BaseDictionary dictionary = provider.lookup(id);
+      writeDictionaryBatch(dictionary, true);

Review Comment:
   nit: may be comment the variable name for `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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to