Java Code Examples for org.apache.parquet.column.page.DataPageV2#getValueCount()

The following examples show how to use org.apache.parquet.column.page.DataPageV2#getValueCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasePageIterator.java    From iceberg with Apache License 2.0 5 votes vote down vote up
protected void initFromPage(DataPageV2 initPage) {
  this.triplesCount = initPage.getValueCount();
  this.repetitionLevels = newRLEIterator(desc.getMaxRepetitionLevel(), initPage.getRepetitionLevels());
  try {
    initDefinitionLevelsReader(initPage, desc);
    LOG.debug("page data size {} bytes and {} records", initPage.getData().size(), triplesCount);
    initDataReader(initPage.getDataEncoding(), initPage.getData().toInputStream(), triplesCount);
  } catch (IOException e) {
    throw new ParquetDecodingException("could not read page " + initPage + " in col " + desc, e);
  }
}
 
Example 2
Source File: PageIterator.java    From iceberg with Apache License 2.0 5 votes vote down vote up
private void initFromPage(DataPageV2 page) {
  this.triplesCount = page.getValueCount();
  this.repetitionLevels = newRLEIterator(desc.getMaxRepetitionLevel(), page.getRepetitionLevels());
  this.definitionLevels = newRLEIterator(desc.getMaxDefinitionLevel(), page.getDefinitionLevels());
  LOG.debug("page data size {} bytes and {} records", page.getData().size(), triplesCount);
  try {
    initDataReader(page.getDataEncoding(), page.getData().toInputStream(), triplesCount);
  } catch (IOException e) {
    throw new ParquetDecodingException("could not read page " + page + " in col " + desc, e);
  }
}
 
Example 3
Source File: AbstractColumnReader.java    From flink with Apache License 2.0 5 votes vote down vote up
private void readPageV2(DataPageV2 page) throws IOException {
	this.pageValueCount = page.getValueCount();

	int bitWidth = BytesUtils.getWidthFromMaxInt(descriptor.getMaxDefinitionLevel());
	// do not read the length from the stream. v2 pages handle dividing the page bytes.
	this.runLenDecoder = new RunLengthDecoder(bitWidth, false);
	this.runLenDecoder.initFromStream(
			this.pageValueCount, page.getDefinitionLevels().toInputStream());
	try {
		prepareNewPage(page.getDataEncoding(), page.getData().toInputStream());
	} catch (IOException e) {
		throw new IOException("could not read page " + page + " in col " + descriptor, e);
	}
}
 
Example 4
Source File: ColumnReaderBase.java    From parquet-mr with Apache License 2.0 5 votes vote down vote up
private void readPageV2(DataPageV2 page) {
  this.repetitionLevelColumn = newRLEIterator(path.getMaxRepetitionLevel(), page.getRepetitionLevels());
  this.definitionLevelColumn = newRLEIterator(path.getMaxDefinitionLevel(), page.getDefinitionLevels());
  int valueCount = page.getValueCount();
  LOG.debug("page data size {} bytes and {} values", page.getData().size(), valueCount);
  try {
    initDataReader(page.getDataEncoding(), page.getData().toInputStream(), valueCount);
  } catch (IOException e) {
    throw new ParquetDecodingException("could not read page " + page + " in col " + path, e);
  }
  newPageInitialized(page);
}
 
Example 5
Source File: ShowPagesCommand.java    From parquet-mr with Apache License 2.0 5 votes vote down vote up
@Override
public String visit(DataPageV2 page) {
  String enc = encodingAsString(page.getDataEncoding(), false);
  long totalSize = page.getCompressedSize();
  int count = page.getValueCount();
  int numRows = page.getRowCount();
  int numNulls = page.getNullCount();
  float perValue = ((float) totalSize) / count;
  String minMax = minMaxAsString(page.getStatistics());
  String compression = (page.isCompressed() ? shortCodec : "_");
  return String.format("%3d-%-3d  %-5s %s %-2s %-7d %-10s %-10s %-8d %-7s %s",
      rowGroupNum, pageNum, "data", compression, enc, count, humanReadable(perValue),
      humanReadable(totalSize), numRows, numNulls, minMax);
}