Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements in parquet PrimitiveColumnWriter #13208

Merged
merged 4 commits into from Jul 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -93,6 +93,7 @@ public class PrimitiveColumnWriter
private final int pageSizeThreshold;

private long bufferedBytes;
private long pageBufferedBytes;

public PrimitiveColumnWriter(ColumnDescriptor columnDescriptor, PrimitiveValueWriter primitiveValueWriter, ValuesWriter definitionLevelWriter, ValuesWriter repetitionLevelWriter, CompressionCodecName compressionCodecName, int pageSizeThreshold)
{
Expand Down Expand Up @@ -242,11 +243,13 @@ private void flushCurrentPageToBuffer()

// update total stats
totalUnCompressedSize += pageHeader.size() + uncompressedSize;
totalCompressedSize += pageHeader.size() + compressedSize;
long pageCompressedSize = pageHeader.size() + compressedSize;
totalCompressedSize += pageCompressedSize;
totalValues += valueCount;

pageBuffer.add(pageHeader);
pageBuffer.add(pageData);
pageBufferedBytes += pageCompressedSize;
raunaqmorarka marked this conversation as resolved.
Show resolved Hide resolved

// Add encoding should be called after ValuesWriter#getBytes() and before ValuesWriter#reset()
encodings.add(repetitionLevelWriter.getEncoding());
Expand Down Expand Up @@ -321,11 +324,6 @@ public long getRetainedBytes()

private void updateBufferedBytes()
{
// Avoid using streams here for performance reasons
long pageBufferedBytes = 0;
for (ParquetDataOutput output : pageBuffer) {
pageBufferedBytes += output.size();
}
bufferedBytes = pageBufferedBytes +
raunaqmorarka marked this conversation as resolved.
Show resolved Hide resolved
definitionLevelWriter.getBufferedSize() +
repetitionLevelWriter.getBufferedSize() +
Expand Down