hililiwei commented on a change in pull request #3784:
URL: https://github.com/apache/iceberg/pull/3784#discussion_r787388761
##########
File path: orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java
##########
@@ -99,9 +104,34 @@ public Metrics metrics() {
@Override
public long length() {
- Preconditions.checkState(isClosed,
- "Cannot return length while appending to an open file.");
- return file.toInputFile().getLength();
+ if (isClosed) {
+ return file.toInputFile().getLength();
+ }
+ if (this.treeWriter != null) {
+ if (batch.size > 0) {
+ try {
+ writer.addRowBatch(batch);
+ batch.reset();
Review comment:
I want to get the byte size of the `batch `here, but I haven't found the
method yet. Because `length` does not contain the size of batch, some test
cases fail.
##########
File path: orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java
##########
@@ -99,9 +104,34 @@ public Metrics metrics() {
@Override
public long length() {
- Preconditions.checkState(isClosed,
- "Cannot return length while appending to an open file.");
- return file.toInputFile().getLength();
+ if (isClosed) {
+ return file.toInputFile().getLength();
+ }
+ if (this.treeWriter != null) {
+ if (batch.size > 0) {
+ try {
+ writer.addRowBatch(batch);
+ batch.reset();
Review comment:
I want to get the byte size of the `batch `here, but I haven't found the
method yet. Because `length` does not contain the size of `batch`, some test
cases fail.
--
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]