slinkydeveloper commented on a change in pull request #18648:
URL: https://github.com/apache/flink/pull/18648#discussion_r804672362



##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -791,6 +796,52 @@ public TableResult executePlan(CompiledPlan plan) {
         return executeInternal(transformations, sinkIdentifierNames);
     }
 
+    private CompiledPlan compilePlanAndWrite(
+            String filePath, boolean ifNotExists, Operation operation) {
+        File file = Paths.get(filePath).toFile();
+        if (file.exists()) {
+            if (ifNotExists) {
+                try {
+                    return loadPlan(PlanReference.fromFile(filePath));
+                } catch (IOException e) {
+                    throw new TableException("Cannot load the plan file '" + 
filePath + "'", e);
+                }
+            }
+
+            if 
(!tableConfig.getConfiguration().get(TableConfigOptions.PLAN_FORCE_RECOMPILE)) {

Review comment:
       So I added a commit where now `writeToFile` is consistent with this 
method. But still I wasn't able to unify them, as there is an essential 
difference here that while in the sql case i don't have an instance of 
`CompiledPlan` already built and with the string value in it, while in table i 
have it. So i had to duplicate the logic in two different places.




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


Reply via email to