lsyldliu commented on code in PR #20361:
URL: https://github.com/apache/flink/pull/20361#discussion_r929988353


##########
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/gateway/context/AddRemoteJarITCase.java:
##########
@@ -0,0 +1,110 @@
+package org.apache.flink.table.client.gateway.context;
+
+import org.apache.flink.client.cli.DefaultCLI;
+import org.apache.flink.util.OperatingSystem;
+import org.apache.flink.util.UserClassLoaderJarTestUtils;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileUtil;
+import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+
+import static org.apache.flink.configuration.PipelineOptions.MAX_PARALLELISM;
+import static org.apache.flink.configuration.PipelineOptions.OBJECT_REUSE;
+import static 
org.apache.flink.table.utils.UserDefinedFunctions.GENERATED_LOWER_UDF_CLASS;
+import static 
org.apache.flink.table.utils.UserDefinedFunctions.GENERATED_LOWER_UDF_CODE;
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** ITCase for adding remote jar. */
+public class AddRemoteJarITCase {
+    @ClassRule public static TemporaryFolder tempFolder = new 
TemporaryFolder();
+

Review Comment:
   We should not introduce this test, the local jar tests has been covered by 
existing test. Regarding to remote jar test, it should be introduced in e2e 
module.



##########
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/gateway/context/SessionContextTest.java:
##########
@@ -156,13 +156,7 @@ public void testAddJarWithRelativePath() throws 
IOException {
 
     @Test
     public void testAddIllegalJar() {
-        validateAddJarWithException("/path/to/illegal.jar", "JAR file does not 
exist");
-    }
-
-    @Test
-    public void testAddRemoteJar() {
-        validateAddJarWithException(

Review Comment:
   This test should not be removed.



##########
flink-table/flink-sql-client/pom.xml:
##########
@@ -515,6 +522,26 @@ under the License.
                        <scope>provided</scope>
                </dependency>
 
+               <dependency>
+                       <groupId>org.apache.hadoop</groupId>
+                       <artifactId>hadoop-hdfs</artifactId>
+                       <scope>test</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.apache.hadoop</groupId>
+                       <artifactId>hadoop-hdfs</artifactId>

Review Comment:
   I think introducing hdfs dependency is a little heavy, we should test remote 
jar in e2e module, so I think these related test should be placed in 
flink-end-to-end-tests-sql module.
   
   Regarding to how to use hdfs cluster in e2e test, you can refer to the 
flink-end-to-end-tests-hbase module.



##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java:
##########
@@ -461,6 +463,23 @@ public boolean dropTemporaryFunction(String path) {
         return 
functionCatalog.dropTemporaryCatalogFunction(unresolvedIdentifier, true);
     }
 
+    @Override
+    public void addJar(String jarPath) {

Review Comment:
   Please add UT about `ADD Jar` and `SHOW JARS` in `TableEnvironmentITCase`, 
add IT case about `ADD Jar` in `TableEnvironmentITCase` which you can refer to 
the related tests in `FunctionITCase`.



##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableEnvironment.java:
##########
@@ -575,6 +576,20 @@ void createFunction(
      */
     boolean dropTemporaryFunction(String path);
 
+    /**
+     * Add jar to the classLoader for use.
+     *
+     * @param jarPath The jar path to be added.
+     */
+    void addJar(String jarPath);

Review Comment:
   We should not introducing these two method, they are public api, we cannot 
introduce public api arbitrarily, it should be discussed in community. We 
should reuse the `AddJarOperation` and `ShowJarsOperation`.



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

Reply via email to