Kooooooma opened a new issue, #14310:
URL: https://github.com/apache/iceberg/issues/14310
### Apache Iceberg version
1.10.0 (latest release)
### Query engine
None
### Please describe the bug 🐞
Source code in org.apache.iceberg.io.DataWriter.hava
```java
public void close() throws IOException {
if (dataFile == null) {
appender.close();
this.dataFile =
DataFiles.builder(spec)
.withFormat(format)
.withPath(location)
.withPartition(partition)
.withEncryptionKeyMetadata(keyMetadata)
.withFileSizeInBytes(appender.length())
.withMetrics(appender.metrics())
.withSplitOffsets(appender.splitOffsets())
.withSortOrder(sortOrder)
.build();
}
}
```
My application code is like
```java
DataWriter writer = Parquet.writeData(outputFile).forTable(table).build();
writer.write(record);
writer.close(); // NPE happened here
```
Seems in above close function, first we closed the appender and in
**appender.close() function set its writer to null**, but then when we build
the DataFile and try to call the appender.length() function, it's directly call
the writer.getDatasize() function, so the NPE was occurred.
### Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [x] I would be willing to contribute a fix for this bug with guidance from
the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
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]