jnh5y commented on code in PR #25064: URL: https://github.com/apache/flink/pull/25064#discussion_r1673973433
########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/delegation/PlannerBase.scala: ########## @@ -182,6 +186,58 @@ abstract class PlannerBase( transformations } + override def loadPlan(planReference: PlanReference): InternalPlan = { + val ctx = createSerdeContext + val objectReader: ObjectReader = JsonSerdeUtil.createObjectReader(ctx) + val execNodeGraph = planReference match { + case filePlanReference: FilePlanReference => + objectReader.readValue(filePlanReference.getFile, classOf[ExecNodeGraph]) + case contentPlanReference: ContentPlanReference => + objectReader.readValue(contentPlanReference.getContent, classOf[ExecNodeGraph]) + case resourcePlanReference: ResourcePlanReference => + val url = resourcePlanReference.getClassLoader + .getResource(resourcePlanReference.getResourcePath) + if (url == null) { + throw new IOException("Cannot load the plan reference from classpath: " + planReference) + } + objectReader.readValue(new File(url.toURI), classOf[ExecNodeGraph]) + case _ => + throw new IllegalStateException( + "Unknown PlanReference. This is a bug, please contact the developers") + } + new ExecNodeGraphInternalPlan( + // ensures that the JSON output is always normalized + () => + JsonSerdeUtil + .createObjectWriter(ctx) + .withDefaultPrettyPrinter() + .writeValueAsString(execNodeGraph), + execNodeGraph) + } Review Comment: I'm pushing this change since CI got hung up. ;) I gathered up a few more lines and extracted creating the `ExecNodeGraphInternalPlan`. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org