Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,9 @@ void writeValue() {
this.writerVersion = writerVersion;
this.maxDefinitionLevel = path.getMaxDefinitionLevel();
DictionaryPage dictionaryPage = pageReader.readDictionaryPage();
Comment thread
pyckle marked this conversation as resolved.
if (dictionaryPage != null) {
try {
this.dictionary = dictionaryPage.getEncoding().initDictionary(path, dictionaryPage);
if (converter.hasDictionarySupport()) {
Comment thread
pyckle marked this conversation as resolved.
converter.setDictionary(dictionary);
}
} catch (IOException e) {
throw new ParquetDecodingException("could not decode the dictionary for " + path, e);
}
} else {
this.dictionary = null;
this.dictionary = dictionaryPage == null ? null : dictionaryPage.getDictionary(path);
if (dictionary != null && converter.hasDictionarySupport()) {
converter.setDictionary(dictionary);
}
this.totalValueCount = pageReader.getTotalValueCount();
if (totalValueCount <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
import java.io.IOException;
import java.util.Objects;
import org.apache.parquet.bytes.BytesInput;
import org.apache.parquet.column.ColumnDescriptor;
import org.apache.parquet.column.Dictionary;
import org.apache.parquet.column.Encoding;
import org.apache.parquet.io.ParquetDecodingException;

/**
* Data for a dictionary page
Expand Down Expand Up @@ -74,6 +77,17 @@ public DictionaryPage copy() throws IOException {
return new DictionaryPage(BytesInput.copy(bytes), getUncompressedSize(), dictionarySize, encoding);
}

/**
* @return the decoded dictionary
*/
public Dictionary getDictionary(ColumnDescriptor path) {
Comment thread
pyckle marked this conversation as resolved.
Outdated
try {
return getEncoding().initDictionary(path, this);
} catch (IOException e) {
throw new ParquetDecodingException("could not decode the dictionary for " + path, e);
}
}

@Override
public String toString() {
return "Page [bytes.size=" + bytes.size() + ", entryCount=" + dictionarySize + ", uncompressedSize="
Expand Down