HuangZhenQiu 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_r328430719
##########
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:
@danny0405 I enhanced the test cases for drop function. But the namespace
lookup of catalog_name.db_name is not handled for all table, function, and
view. It requires a bigger change, so I would like to leave it as another PR.
How do you think?
----------------------------------------------------------------
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