RussellSpitzer commented on a change in pull request #3780:
URL: https://github.com/apache/iceberg/pull/3780#discussion_r784241755



##########
File path: parquet/src/main/java/org/apache/iceberg/parquet/ParquetWriter.java
##########
@@ -138,30 +153,41 @@ public Metrics metrics() {
   @Override
   public long length() {
     try {
-      if (closed) {
-        return writer.getPos();
-      } else {
-        return writer.getPos() + (writeStore.isColumnFlushNeeded() ? 
writeStore.getBufferedSize() : 0);
+      long length = 0L;
+
+      if (writer != null) {
+        length += writer.getPos();
       }
+
+      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();

Review comment:
       I know this isn't realated to this pr, but what is `getBufferedSize()` 
when record count == 0 or the writer is closed? Just seems odd that we can't 
always add this on. NBD just wondering




-- 
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]

Reply via email to