use of org.apache.parquet.column.Encoding in project parquet-mr by apache.
the class ColumnWriterV2 method writePage.
/**
* writes the current data to a new page in the page store
* @param rowCount how many rows have been written so far
*/
public void writePage(long rowCount) {
int pageRowCount = Ints.checkedCast(rowCount - rowsWrittenSoFar);
this.rowsWrittenSoFar = rowCount;
if (DEBUG)
LOG.debug("write page");
try {
// TODO: rework this API. Those must be called *in that order*
BytesInput bytes = dataColumn.getBytes();
Encoding encoding = dataColumn.getEncoding();
pageWriter.writePageV2(pageRowCount, Ints.checkedCast(statistics.getNumNulls()), valueCount, path.getMaxRepetitionLevel() == 0 ? BytesInput.empty() : repetitionLevelColumn.toBytes(), path.getMaxDefinitionLevel() == 0 ? BytesInput.empty() : definitionLevelColumn.toBytes(), encoding, bytes, statistics);
} catch (IOException e) {
throw new ParquetEncodingException("could not write page for " + path, e);
}
repetitionLevelColumn.reset();
definitionLevelColumn.reset();
dataColumn.reset();
valueCount = 0;
resetStatistics();
}
Aggregations