ggershinsky commented on code in PR #1349:
URL: https://github.com/apache/parquet-mr/pull/1349#discussion_r1601433436


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/metadata/ParquetMetadata.java:
##########
@@ -50,19 +60,23 @@ public static String toPrettyJSON(ParquetMetadata 
parquetMetaData) {
 
   private static String toJSON(ParquetMetadata parquetMetaData, boolean 
isPrettyPrint) {
     try (StringWriter stringWriter = new StringWriter()) {
+      Object objectToPrint;
+      if (parquetMetaData.getFileMetaData() == null
+          || parquetMetaData.getFileMetaData().getEncryptionType()
+              == FileMetaData.EncryptionType.UNENCRYPTED) {
+        objectToPrint = parquetMetaData;
+      } else {
+        objectToPrint = parquetMetaData.getFileMetaData();
+      }
+
+      ObjectWriter writer;
       if (isPrettyPrint) {
-        Object objectToPrint;
-        if (parquetMetaData.getFileMetaData() == null
-            || parquetMetaData.getFileMetaData().getEncryptionType()
-                == FileMetaData.EncryptionType.UNENCRYPTED) {
-          objectToPrint = parquetMetaData;
-        } else {
-          objectToPrint = parquetMetaData.getFileMetaData();
-        }
-        objectMapper.writerWithDefaultPrettyPrinter().writeValue(stringWriter, 
objectToPrint);
+        writer = objectMapper.writerWithDefaultPrettyPrinter();
       } else {
-        objectMapper.writeValue(stringWriter, parquetMetaData);

Review Comment:
   SGTM, thanks



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