snuyanzin commented on code in PR #26683:
URL: https://github.com/apache/flink/pull/26683#discussion_r2149653785
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/serde/CompiledPlanSerdeUtil.java:
##########
@@ -265,6 +277,47 @@ static <T> Optional<T> deserializeOptionalField(
return Optional.empty();
}
+ static <T> List<T> deserializeList(
+ ObjectNode objectNode,
+ String fieldName,
+ Class<? extends T> type,
+ ObjectCodec codec,
+ DeserializationContext ctx)
+ throws IOException {
+ return ctx.readValue(
+ traverse(objectNode.required(fieldName), codec),
+ ctx.getTypeFactory().constructCollectionType(List.class,
type));
+ }
+
+ static <T> List<T> deserializeListOrEmpty(
+ ObjectNode objectNode,
+ String fieldName,
+ Class<? extends T> type,
+ ObjectCodec codec,
+ DeserializationContext ctx)
+ throws IOException {
+ if (objectNode.hasNonNull(fieldName)) {
+ return deserializeList(objectNode, fieldName, type, codec, ctx);
+ }
+ return List.of();
+ }
+
+ static <K, V> Map<K, V> deserializeMapOrEmpty(
Review Comment:
do you have example of it for compiled plan?
I made only for those collections which I noticed
Once any new collection/array appears there might be added a dedicated method
--
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]