You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/01/13 18:55:58 UTC
[GitHub] [iceberg] RussellSpitzer commented on a change in pull request #3780: Lazily initialize the underlying writer in ParquetWriter
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org