Skip to content

Commit

Permalink
fix: ColumnReader.loadVector should initiate CometDictionary afte…
Browse files Browse the repository at this point in the history
…r re-import arrays (apache#473)

(cherry picked from commit 5bfe46d)
  • Loading branch information
viirya authored and Huaxin Gao committed May 31, 2024
1 parent 40c9f34 commit 77ceaa9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions common/src/main/java/org/apache/comet/parquet/ColumnReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

currentVector =
new CometDictionaryVector(
cometVector, dictionary, dictionaryProvider, useDecimal128, false, isUuid);
Expand Down

0 comments on commit 77ceaa9

Please sign in to comment.