You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by al...@apache.org on 2019/01/17 12:22:36 UTC

[flink] branch master updated: [FLINK-11371] The AvroParquetReader is not being closed

This is an automated email from the ASF dual-hosted git repository.

aljoscha pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a54983  [FLINK-11371] The AvroParquetReader is not being closed
0a54983 is described below

commit 0a54983ca0207444477cfe991dbee1b611496204
Author: Fokko Driesprong <fo...@godatadriven.com>
AuthorDate: Wed Jan 16 17:04:28 2019 +0100

    [FLINK-11371] The AvroParquetReader is not being closed
---
 .../formats/parquet/avro/ParquetStreamingFileSinkITCase.java     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/flink-formats/flink-parquet/src/test/java/org/apache/flink/formats/parquet/avro/ParquetStreamingFileSinkITCase.java b/flink-formats/flink-parquet/src/test/java/org/apache/flink/formats/parquet/avro/ParquetStreamingFileSinkITCase.java
index 484ef86..7e61521 100644
--- a/flink-formats/flink-parquet/src/test/java/org/apache/flink/formats/parquet/avro/ParquetStreamingFileSinkITCase.java
+++ b/flink-formats/flink-parquet/src/test/java/org/apache/flink/formats/parquet/avro/ParquetStreamingFileSinkITCase.java
@@ -169,12 +169,13 @@ public class ParquetStreamingFileSinkITCase extends AbstractTestBase {
 
 	private static <T> List<T> readParquetFile(File file, GenericData dataModel) throws IOException {
 		InputFile inFile = HadoopInputFile.fromPath(new org.apache.hadoop.fs.Path(file.toURI()), new Configuration());
-		ParquetReader<T> reader = AvroParquetReader.<T>builder(inFile).withDataModel(dataModel).build();
 
 		ArrayList<T> results = new ArrayList<>();
-		T next;
-		while ((next = reader.read()) != null) {
-			results.add(next);
+		try (ParquetReader<T> reader = AvroParquetReader.<T>builder(inFile).withDataModel(dataModel).build()) {
+			T next;
+			while ((next = reader.read()) != null) {
+				results.add(next);
+			}
 		}
 
 		return results;