danny0405 commented on a change in pull request #1455: [CALCITE-3349] Add 
create and drop function into SqlKind ddl enumerations
URL: https://github.com/apache/calcite/pull/1455#discussion_r327939178
 
 

 ##########
 File path: server/src/test/java/org/apache/calcite/test/ServerTest.java
 ##########
 @@ -166,6 +166,42 @@ static Connection connect() throws SQLException {
     }
   }
 
+  @Test public void testCreateFunction() throws Exception {
+    try (Connection c = connect();
+         Statement s = c.createStatement()) {
+      boolean b = s.execute("create schema s");
+      assertThat(b, is(false));
+      try {
+        boolean f = s.execute("create function if not exists s.t \n" +
+                "as 'org.apache.calcite.udf.TableFun.demoUdf'\n" +
+                "using jar 'file:/path/udf/udf-0.0.1-SNAPSHOT.jar'");
+      } catch (SQLException e) {
+        assertThat(e.getMessage(),
+                containsString("Sql create function ddl is not support yet"));
+      }
+    }
+  }
+
+  @Test public void testDropFunction() throws Exception {
+    try (Connection c = connect();
+         Statement s = c.createStatement()) {
+      boolean b = s.execute("create schema s");
+      assertThat(b, is(false));
+
+      boolean f = s.execute("drop function if exists t");
+      assertThat(f, is(false));
+
+      try {
+        boolean f2 = s.execute("drop function t");
+        assertThat(f2, is(false));
+      } catch (SQLException e) {
+        assertThat(e.getMessage(),
+                containsString("Error while executing SQL \"drop function 
t\":" +
+                        " At line 1, column 15: Type 'T' not found"));
 
 Review comment:
   We do not need the create function to be implemented, just put the function 
explicitly into the schema is ok, then we can add drop function test.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to