flyrain commented on code in PR #4546:
URL: https://github.com/apache/iceberg/pull/4546#discussion_r855527722


##########
core/src/main/java/org/apache/iceberg/PartitionSpecParser.java:
##########
@@ -83,6 +80,22 @@ public static String toJson(UnboundPartitionSpec spec, 
boolean pretty) {
     }
   }
 
+  public static void toJson(PartitionSpec spec, JsonGenerator generator) 
throws IOException {
+    toJson(spec.toUnbound(), generator);
+  }
+
+  public static void toJson(UnboundPartitionSpec spec, JsonGenerator 
generator) throws IOException {
+    toJson(spec, generator, null);
+  }
+
+  private static void toJson(UnboundPartitionSpec spec, JsonGenerator 
generator, Schema schema) throws IOException {
+    generator.writeStartObject();
+    generator.writeNumberField(SPEC_ID, spec.specId());
+    generator.writeFieldName(FIELDS);
+    toJsonFields(spec, generator, schema);
+    generator.writeEndObject();
+  }
+

Review Comment:
   Adjusted the order of methods, so that it looks better. From top to bottom, 
the methods `toJson` have 1 parameter, 2 parameters and 3 parameters 
respectively. Each layer depends on the under layer.
   ```
   toJson(PartitionSpec spec)
   toJson(UnboundPartitionSpec spec)
   
   toJson(PartitionSpec spec, boolean pretty)
   toJson(UnboundPartitionSpec spec, boolean pretty)
   
   toJson(UnboundPartitionSpec spec, Schema schema, boolean pretty)
   ```



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