viirya commented on code in PR #473:
URL: https://github.com/apache/datafusion-comet/pull/473#discussion_r1614819511


##########
common/src/main/java/org/apache/comet/parquet/ColumnReader.java:
##########
@@ -230,15 +230,15 @@ public CometDecodedVector loadVector() {
         // return plain vector.
         currentVector = cometVector;
         return currentVector;
-      } else if (dictionary == null) {
-        // There is dictionary from native side but the Java side dictionary 
hasn't been
-        // initialized yet.
-        Dictionary arrowDictionary = 
dictionaryProvider.lookup(dictionaryEncoding.getId());
-        CometPlainVector dictionaryVector =
-            new CometPlainVector(arrowDictionary.getVector(), useDecimal128, 
isUuid);
-        dictionary = new CometDictionary(dictionaryVector);
       }
 
+      // We should already re-initiate `CometDictionary` here because 
`Data.importVector` API will
+      // release the previous dictionary vector and create a new one.
+      Dictionary arrowDictionary = 
dictionaryProvider.lookup(dictionaryEncoding.getId());
+      CometPlainVector dictionaryVector =
+          new CometPlainVector(arrowDictionary.getVector(), useDecimal128, 
isUuid);
+      dictionary = new CometDictionary(dictionaryVector);
+

Review Comment:
   The test failure is in TPCDSQuerySuite in #437. I don't have a simple 
reproducible test case for it. But I think the change is straightforward and 
safe.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to