-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
More accurate estimate on parquet row groups size #11258
base: main
Are you sure you want to change the base?
Changes from 1 commit
07f6b97
5854ccb
c83198e
5e64668
742eaac
07fe927
98ecfac
a6e9ef3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,7 +172,7 @@ public long length() { | |
if (!closed && recordCount > 0) { | ||
// recordCount > 0 when there are records in the write store that have not been flushed to | ||
// the Parquet file | ||
length += writeStore.getBufferedSize(); | ||
length += estimateBufferSize(); | ||
} | ||
|
||
return length; | ||
|
@@ -192,7 +192,7 @@ public List<Long> splitOffsets() { | |
|
||
private long estimateBufferSize() { | ||
if (totalRowGroupSize == 0 || totalBufferSize == 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this also fallback to |
||
return currentBufferSize; | ||
return writeStore.getBufferedSize(); | ||
} | ||
|
||
return currentBufferSize * totalRowGroupSize / totalBufferSize; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -557,8 +557,8 @@ public void testBinPackCombineMixedFiles() { | |
|
||
@Test | ||
public void testBinPackCombineMediumFiles() { | ||
Table table = createTable(4); | ||
shouldHaveFiles(table, 4); | ||
Table table = createTable(6); | ||
shouldHaveFiles(table, 6); | ||
Comment on lines
+560
to
+561
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After this change, the test table has smaller number of row groups. Small change like 4->3 may cause small tail when generating taskGroups Using 6 -> 3 can have better tolerance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand why changes to this test are being made There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4/3 may produce groups with [1.4, 1.3, 1.3] or [1.3, 1.3, 1.3, 0.1] |
||
|
||
List<Object[]> expectedRecords = currentData(); | ||
int targetSize = ((int) testDataSize(table) / 3); | ||
|
@@ -578,7 +578,7 @@ public void testBinPackCombineMediumFiles() { | |
|
||
assertThat(result.rewrittenDataFilesCount()) | ||
.as("Action should delete 4 data files") | ||
.isEqualTo(4); | ||
.isEqualTo(6); | ||
assertThat(result.addedDataFilesCount()).as("Action should add 3 data files").isEqualTo(3); | ||
assertThat(result.rewrittenBytesCount()).isEqualTo(dataSizeBefore); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename
estimateBufferSize
toestimateBufferedSize
for naming consistency.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, can we add a few comments about the estimation logic? i.e. what the ratio
totalRowGroupSize / totalBufferSize
means as estimating the ratio of size reduction to match closely what will be written out encoded/compressed.