luoyuxia commented on code in PR #20413:
URL: https://github.com/apache/flink/pull/20413#discussion_r939466542


##########
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java:
##########
@@ -1121,6 +1122,35 @@ public void testSetCommand() throws Exception {
         assertThat(result.toString()).isEqualTo(String.format("[+I[%s]]", 
path));
     }
 
+    @Test
+    public void testAddCommand() {
+        TableEnvironmentInternal tableEnvInternal = (TableEnvironmentInternal) 
tableEnv;
+        Parser parser = tableEnvInternal.getParser();
+
+        // test add jar
+        Operation operation = parser.parse("add jar test.jar").get(0);
+        assertThat(operation).isInstanceOf(AddJarOperation.class);
+        assertThat(((AddJarOperation) 
operation).getPath()).isEqualTo("test.jar");
+        // test add jar with variable substitute
+        operation = parser.parse("add jar 
\"${hiveconf:common-key}.jar\"").get(0);
+        assertThat(operation).isInstanceOf(AddJarOperation.class);
+        assertThat(((AddJarOperation) 
operation).getPath()).isEqualTo("\"common-val.jar\"");

Review Comment:
   Actually this a valid `ADD JAR command` at least for parse phase.
   For command: `add file "df.xf"`
   In hive: it will throw exception `Query returned non-zero code: 1, cause: 
java.net.URISyntaxException: Illegal character in path at index 0: "df.xf"` 
which is actually thrown in execution phase.
   In spark: it won't throw exception, and the `"` will be escaped to `%22`.



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