nssalian commented on code in PR #16327:
URL: https://github.com/apache/iceberg/pull/16327#discussion_r3249517202
##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetWriter.java:
##########
@@ -190,6 +204,30 @@ public List<Long> splitOffsets() {
}
private void checkSize() {
+ if (trackUncompressedSize) {
+ checkSizeUncompressed();
+ } else {
+ checkSizeDefault();
+ }
+ }
+
+ private void checkSizeUncompressed() {
+ if (rowGroupUncompressedSize >= targetRowGroupSize) {
+ flushRowGroup(false);
+ } else if (recordCount >= nextCheckRecordCount) {
+ double avgRecordSize = ((double) rowGroupUncompressedSize) / recordCount;
+ if (rowGroupUncompressedSize > (targetRowGroupSize - 2 * avgRecordSize))
{
+ flushRowGroup(false);
+ } else {
+ long remainingSpace = targetRowGroupSize - rowGroupUncompressedSize;
+ long remainingRecords = (long) (remainingSpace / avgRecordSize);
+ this.nextCheckRecordCount =
+ recordCount + Math.min(remainingRecords / 2,
props.getMaxRowCountForPageSizeCheck());
+ }
+ }
+ }
+
+ private void checkSizeDefault() {
Review Comment:
Let me think of a better name.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]