This is an automated email from the ASF dual-hosted git repository.

jark pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 1a094eb3619e9696759eaf1a5a0dad4e6852bb12
Author: Jark Wu <[email protected]>
AuthorDate: Sat Aug 6 20:28:47 2022 +0800

    [FLINK-28772][hive] Improve exception messages for ADD JAR
    
    This closes #20413
---
 .../flink/table/planner/delegation/hive/HiveParser.java    |  6 +++---
 .../apache/flink/connectors/hive/HiveDialectITCase.java    | 14 +++++++-------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParser.java
 
b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParser.java
index 7ec483fdbfd..1fb2bf88ce0 100644
--- 
a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParser.java
+++ 
b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParser.java
@@ -313,14 +313,14 @@ public class HiveParser extends ParserImpl {
         SessionState.ResourceType resourceType = 
SessionState.find_resource_type(tokens[0]);
         if (resourceType == SessionState.ResourceType.FILE) {
             throw new UnsupportedOperationException(
-                    "ADD FILE is not supported yet. Usage: add JAR <value>");
+                    "ADD FILE is not supported yet. Usage: ADD JAR 
<file_path>");
         } else if (resourceType == SessionState.ResourceType.ARCHIVE) {
             throw new UnsupportedOperationException(
-                    "Add ARCHIVE is not supported yet. Usage: add JAR 
<value>");
+                    "ADD ARCHIVE is not supported yet. Usage: ADD JAR 
<file_path>");
         } else if (resourceType == SessionState.ResourceType.JAR) {
             if (tokens.length != 2) {
                 throw new UnsupportedOperationException(
-                        "Add multiple jar in one single statement is not 
supported yet. Usage: add JAR <value>");
+                        "Add multiple jar in one single statement is not 
supported yet. Usage: ADD JAR <file_path>");
             }
             return new AddJarOperation(tokens[1]);
         } else {
diff --git 
a/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
 
b/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
index 4ecc4d7ea68..0111e3e2f3d 100644
--- 
a/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
+++ 
b/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
@@ -1155,21 +1155,21 @@ public class HiveDialectITCase {
         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);
+        operation = parser.parse("add jar ${hiveconf:common-key}.jar").get(0);
         assertThat(operation).isInstanceOf(AddJarOperation.class);
-        assertThat(((AddJarOperation) 
operation).getPath()).isEqualTo("\"common-val.jar\"");
+        assertThat(((AddJarOperation) 
operation).getPath()).isEqualTo("common-val.jar");
 
         // test unsupported add command
         assertThatThrownBy(() -> tableEnv.executeSql("add jar t1.jar t2.jar"))
                 .isInstanceOf(UnsupportedOperationException.class)
                 .hasMessage(
-                        "Add multiple jar in one single statement is not 
supported yet. Usage: add JAR <value>");
-        assertThatThrownBy(() -> tableEnv.executeSql("add File t1.txt"))
+                        "Add multiple jar in one single statement is not 
supported yet. Usage: ADD JAR <file_path>");
+        assertThatThrownBy(() -> tableEnv.executeSql("add file t1.txt"))
                 .isInstanceOf(UnsupportedOperationException.class)
-                .hasMessage("ADD FILE is not supported yet. Usage: add JAR 
<value>");
-        assertThatThrownBy(() -> tableEnv.executeSql("add Archive t1.tgz"))
+                .hasMessage("ADD FILE is not supported yet. Usage: ADD JAR 
<file_path>");
+        assertThatThrownBy(() -> tableEnv.executeSql("add archive t1.tgz"))
                 .isInstanceOf(UnsupportedOperationException.class)
-                .hasMessage("Add ARCHIVE is not supported yet. Usage: add JAR 
<value>");
+                .hasMessage("ADD ARCHIVE is not supported yet. Usage: ADD JAR 
<file_path>");
     }
 
     @Test

Reply via email to