dawidwys commented on code in PR #23655:
URL: https://github.com/apache/flink/pull/23655#discussion_r1381570218
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/ExecNodeGraphInternalPlan.java:
##########
@@ -34,16 +34,17 @@
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.List;
+import java.util.function.Supplier;
import java.util.stream.Collectors;
/** Implementation of {@link CompiledPlan} backed by an {@link ExecNodeGraph}.
*/
@Internal
public class ExecNodeGraphInternalPlan implements InternalPlan {
- private final String serializedPlan;
+ private final Supplier<String> serializedPlan;
Review Comment:
nit: Should we cache it?
```
String getSerializedString() {
if (serializedPlan == null) {
this.serializedPlan = serializedPlanSupplier.get();
}
return serializedPlan;
}
```
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/delegation/StreamPlanner.scala:
##########
@@ -190,10 +190,12 @@ class StreamPlanner(
}
new ExecNodeGraphInternalPlan(
- JsonSerdeUtil
- .createObjectWriter(ctx)
- .withDefaultPrettyPrinter()
- .writeValueAsString(execNodeGraph),
+ // ensures that the JSON output is always normalized
+ () =>
+ JsonSerdeUtil
+ .createObjectWriter(ctx)
Review Comment:
Should we rather freeze the `ObjectWriter` before passing it to the
`Supplier`? Otherwise it's hard to tell what is the configuration used.
WDYT:
```
val writer = JsonSerdeUtil.createObjectWriter(ctx)
new ExecNodeGraphInternalPlan(
// ensures that the JSON output is always normalized
() => writer
.withDefaultPrettyPrinter()
.writeValueAsString(execNodeGraph),
execNodeGraph)
)
```
--
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]