rdblue commented on a change in pull request #2001:
URL: https://github.com/apache/iceberg/pull/2001#discussion_r549792717
##########
File path:
parquet/src/test/java/org/apache/iceberg/parquet/ParquetWritingTestUtils.java
##########
@@ -53,20 +54,43 @@ static File writeRecords(TemporaryFolder temp, Schema
schema,
}
static File writeRecords(
- TemporaryFolder temp,
- Schema schema, Map<String, String> properties,
- Function<MessageType, ParquetValueWriter<?>> createWriterFunc,
- GenericData.Record... records) throws IOException {
+ TemporaryFolder temp,
+ Schema schema, Map<String, String> properties,
+ Function<MessageType, ParquetValueWriter<?>> createWriterFunc,
+ GenericData.Record... records) throws IOException {
+ File file = createTempFile(temp);
+ write(file, schema, properties, createWriterFunc, records);
+ return file;
+ }
+
+ static long write(File file, Schema schema, Map<String, String> properties,
+ Function<MessageType, ParquetValueWriter<?>>
createWriterFunc,
+ GenericData.Record... records) throws IOException {
+ FileAppender<GenericData.Record> writer = Parquet.write(localOutput(file))
Review comment:
This should still use try-with-resources. You just have to keep a
reference to the writer outside of it:
```java
FileAppender<Record> writer = Parquet.write(...);
try (Closeable toClose = writer) {
writer.addAll(records);
}
writer.length();
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]