LadyForest commented on code in PR #22539:
URL: https://github.com/apache/flink/pull/22539#discussion_r1222720612


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java:
##########
@@ -761,7 +760,9 @@ private CompiledPlan compilePlanAndWrite(
                             + ". This is a bug, please file an issue.");
         }
 
-        compiledPlan.writeToFile(file, false);
+        compiledPlan.writeToFile(localPath, false);
+        resourceManager.updateFilePath(filePath);

Review Comment:
   Correct me if I'm wrong, but I think we should not and probably cannot write 
files to a remote FileSystem. 
   
   Although users have configured related conf in flink-conf.yaml, such as 
accessKey and accessSecret, having permission to read files under a bucket does 
not mean having the same write permission. 
   
   If users feel it is necessary, they can upload files manually. Implementing 
this through the framework may have many limitations.



##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java:
##########
@@ -83,6 +83,60 @@ public ResourceManager(ReadableConfig config, 
MutableURLClassLoader userClassLoa
         this.userClassLoader = userClassLoader;
     }
 
+    public boolean exists(Path filePath) throws IOException {
+        boolean exist;
+        FileSystem fs = FileSystem.getUnguardedFileSystem(filePath.toUri());
+        exist = fs.exists(filePath);
+        return exist;
+    }
+
+    /**
+     * register the filePath of flink filesystem. If it is remote filesystem 
and the file exists

Review Comment:
   Nit: JavaDoc comments should start with the capitalized sentence. You can 
take https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
   as a ref.



##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java:
##########
@@ -83,6 +83,60 @@ public ResourceManager(ReadableConfig config, 
MutableURLClassLoader userClassLoa
         this.userClassLoader = userClassLoader;
     }
 
+    public boolean exists(Path filePath) throws IOException {
+        boolean exist;
+        FileSystem fs = FileSystem.getUnguardedFileSystem(filePath.toUri());
+        exist = fs.exists(filePath);
+        return exist;

Review Comment:
   Can we inline this?
   
   ```java
   return FileSystem.getUnguardedFileSystem(filePath.toUri()).exists(filePath);
   ```



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