use of parquet.io.ParquetDecodingException in project presto by prestodb.
the class ParquetColumnReader method setPageReader.
public void setPageReader(ParquetPageReader pageReader) {
this.pageReader = requireNonNull(pageReader, "pageReader");
ParquetDictionaryPage dictionaryPage = pageReader.readDictionaryPage();
if (dictionaryPage != null) {
try {
dictionary = dictionaryPage.getEncoding().initDictionary(columnDescriptor, dictionaryPage);
} catch (IOException e) {
throw new ParquetDecodingException("could not decode the dictionary for " + columnDescriptor, e);
}
} else {
dictionary = null;
}
checkArgument(pageReader.getTotalValueCount() > 0, "page is empty");
totalValueCount = pageReader.getTotalValueCount();
}
use of parquet.io.ParquetDecodingException in project presto by prestodb.
the class ParquetColumnReader method readPageV1.
private ValuesReader readPageV1(ParquetDataPageV1 page) {
ValuesReader rlReader = page.getRepetitionLevelEncoding().getValuesReader(columnDescriptor, REPETITION_LEVEL);
ValuesReader dlReader = page.getDefinitionLevelEncoding().getValuesReader(columnDescriptor, DEFINITION_LEVEL);
repetitionReader = new ParquetLevelValuesReader(rlReader);
definitionReader = new ParquetLevelValuesReader(dlReader);
try {
byte[] bytes = page.getSlice().getBytes();
rlReader.initFromPage(page.getValueCount(), bytes, 0);
int offset = rlReader.getNextOffset();
dlReader.initFromPage(page.getValueCount(), bytes, offset);
offset = dlReader.getNextOffset();
return initDataReader(page.getValueEncoding(), bytes, offset, page.getValueCount());
} catch (IOException e) {
throw new ParquetDecodingException("Error reading parquet page " + page + " in column " + columnDescriptor, e);
}
}
use of parquet.io.ParquetDecodingException in project shifu by ShifuML.
the class GuaguaParquetMapReduceClient method getPigSchemaFromMultipleFiles.
/**
* @param fileSchema
* the parquet schema from the file
* @param keyValueMetaData
* the extra meta data from the files
* @return the pig schema according to the file
*/
static Schema getPigSchemaFromMultipleFiles(MessageType fileSchema, Map<String, Set<String>> keyValueMetaData) {
Set<String> pigSchemas = PigMetaData.getPigSchemas(keyValueMetaData);
if (pigSchemas == null) {
return pigSchemaConverter.convert(fileSchema);
}
Schema mergedPigSchema = null;
for (String pigSchemaString : pigSchemas) {
try {
mergedPigSchema = union(mergedPigSchema, parsePigSchema(pigSchemaString));
} catch (FrontendException e) {
throw new ParquetDecodingException("can not merge " + pigSchemaString + " into " + mergedPigSchema, e);
}
}
return mergedPigSchema;
}
Aggregations