dramaticlly commented on code in PR #17931:
URL: https://github.com/apache/iceberg/pull/17931#discussion_r3921350780


##########
core/src/main/java/org/apache/iceberg/view/ViewMetadataParser.java:
##########
@@ -190,11 +190,10 @@ private static void internalWrite(
     boolean isGzip = Codec.fromFileName(outputFile.location()) == Codec.GZIP;
     OutputStream stream = overwrite ? outputFile.createOrOverwrite() : 
outputFile.create();
     try (OutputStreamWriter writer =
-        new OutputStreamWriter(
-            isGzip ? new GZIPOutputStream(stream) : stream, 
StandardCharsets.UTF_8)) {
-      JsonGenerator generator = JsonUtil.factory().createGenerator(writer);
+            new OutputStreamWriter(
+                isGzip ? new GZIPOutputStream(stream) : stream, 
StandardCharsets.UTF_8);
+        JsonGenerator generator = JsonUtil.factory().createGenerator(writer)) {
       toJson(metadata, generator);
-      generator.flush();

Review Comment:
   thanks @singhpk234  Originally I was thinking we don't read the json 
generator from the block so we can rely on close to auto flush. But I think 
there's also value of being explicit and flush before close. 



-- 
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]

Reply via email to