本文整理匯總了Java中parquet.format.DictionaryPageHeader類的典型用法代碼示例。如果您正苦於以下問題:Java DictionaryPageHeader類的具體用法?Java DictionaryPageHeader怎麽用?Java DictionaryPageHeader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DictionaryPageHeader類屬於parquet.format包,在下文中一共展示了DictionaryPageHeader類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readDictionaryPage
import parquet.format.DictionaryPageHeader; //導入依賴的package包/類
private static DictionaryPage readDictionaryPage(byte[] data, ParquetCodecFactory codecFactory, CompressionCodecName codecName)
{
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
PageHeader pageHeader = Util.readPageHeader(inputStream);
if (pageHeader.type != PageType.DICTIONARY_PAGE) {
return null;
}
// todo this wrapper is not needed
BytesInput compressedData = BytesInput.from(data, data.length - inputStream.available(), pageHeader.getCompressed_page_size());
BytesDecompressor decompressor = codecFactory.getDecompressor(codecName);
BytesInput decompressed = decompressor.decompress(compressedData, pageHeader.getUncompressed_page_size());
DictionaryPageHeader dicHeader = pageHeader.getDictionary_page_header();
Encoding encoding = Encoding.valueOf(dicHeader.getEncoding().name());
int dictionarySize = dicHeader.getNum_values();
return new DictionaryPage(decompressed, dictionarySize, encoding);
}
catch (IOException ignored) {
return null;
}
}
示例2: writeDictionaryPageHeader
import parquet.format.DictionaryPageHeader; //導入依賴的package包/類
public void writeDictionaryPageHeader(
int uncompressedSize, int compressedSize, int valueCount,
parquet.column.Encoding valuesEncoding, OutputStream to) throws IOException {
PageHeader pageHeader = new PageHeader(PageType.DICTIONARY_PAGE, uncompressedSize, compressedSize);
pageHeader.setDictionary_page_header(new DictionaryPageHeader(valueCount, getEncoding(valuesEncoding)));
writePageHeader(pageHeader, to);
}
示例3: readDictionaryPage
import parquet.format.DictionaryPageHeader; //導入依賴的package包/類
private DictionaryPage readDictionaryPage(PageHeader pageHeader, int uncompressedPageSize, int compressedPageSize)
throws IOException
{
DictionaryPageHeader dicHeader = pageHeader.getDictionary_page_header();
return new DictionaryPage(getBytesInput(compressedPageSize),
uncompressedPageSize,
dicHeader.getNum_values(),
Encoding.valueOf(dicHeader.getEncoding().name()));
}