nastra commented on code in PR #5802:
URL: https://github.com/apache/iceberg/pull/5802#discussion_r975047073
##########
core/src/main/java/org/apache/iceberg/PartitionSpecParser.java:
##########
@@ -66,19 +65,7 @@ public static String toJson(UnboundPartitionSpec spec) {
}
public static String toJson(UnboundPartitionSpec spec, boolean pretty) {
- try {
- StringWriter writer = new StringWriter();
- JsonGenerator generator = JsonUtil.factory().createGenerator(writer);
- if (pretty) {
- generator.useDefaultPrettyPrinter();
- }
- toJson(spec, generator);
- generator.flush();
- return writer.toString();
-
- } catch (IOException e) {
- throw new RuntimeIOException(e);
- }
+ return JsonUtil.generate(gen -> toJson(spec, gen), pretty);
Review Comment:
> BTW we have a bit duplicated code for parsing as well. I was changing it
in https://github.com/apache/iceberg/pull/5048.
ah interesting, you're right. Do you want to open maybe a separate PR for
removing that part of duplicated code?
--
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]