[CALCITE-3349] Add create and drop function into SqlKind ddl enumerations#1455
[CALCITE-3349] Add create and drop function into SqlKind ddl enumerations#1455HuangZhenQiu wants to merge 5 commits intoapache:masterfrom
Conversation
|
@suez1224 Would you please help and review this PR? |
|
For the details, please refer to https://issues.apache.org/jira/browse/CALCITE-3349. |
|
@julianhyde |
danny0405
left a comment
There was a problem hiding this comment.
I don't know how to test either, but i'm okey on this change.
|
Be sure to fix capitalization in the commit message. |
|
@julianhyde Thanks for pointing it out. I just updated the PR with a new commit log. |
| */ | ||
| public class SqlDropFunction extends SqlDropObject { | ||
| public class SqlDropFunction extends SqlDropObject | ||
| implements SqlExecutableStatement { |
There was a problem hiding this comment.
isn't SqlDropObject already implement SqlExecutableStatement ?
There was a problem hiding this comment.
It is, but does not include create/drop function, we can remove the implements from SqlExecutableStatement.
|
Would it make sense to have a test for adding and dropping functions? Then we can all agree that this change is "complete". |
|
@HuangZhenQiu Can you follow Julian's suggestion to add some tests ? |
|
@julianhyde @danny0405 Sure. Will do in the next revision. |
|
@danny0405 @julianhyde |
| } catch (SQLException e) { | ||
| assertThat(e.getMessage(), | ||
| containsString("Error while executing SQL \"drop function t\":" + | ||
| " At line 1, column 15: Type 'T' not found")); |
There was a problem hiding this comment.
We should also throw exception message as "XXX not support" instead "XXX not found".
There was a problem hiding this comment.
I added the default execution logic in SqlDrop for SqlDropFunction, so it will throw function not found in the root schema.
There was a problem hiding this comment.
Yean, i mean we do not even support "drop function" then why throws "xxx function not found" ?
There was a problem hiding this comment.
Oops, my mistake, you actually implement the "Drop function". Then we should add more tests about drop function:
Positive tests
- Add a function in the schema and test remove with(without) if exists
- Test drop function with specified catalog name and database name, i.e.
DROP FUNCTION catalog_name.db_name.func_name
Negative tests
- Test drop function what does not exist
- Test drop function with case_sensive true but not found
There was a problem hiding this comment.
@danny0405
Agree. If the create function is implemented, more test cases are needed. Currently, as the create function is not there, I can't add and drop function in test case. Thus, I would put the implementation of create and drop function in another PR, and leave this PR simple.
There was a problem hiding this 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.
There was a problem hiding this 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?
There was a problem hiding this comment.
I'm fine with the latest change, thanks.
578ec23 to
79228e6
Compare
570ba21 to
3448700
Compare
3448700 to
1ff85b6
Compare
Close apache#1455 Change-Id: Id3b8cdcf31879db5a8a7db43b1e60bd8e1b33e4e
Close apache#1455 Change-Id: Id3b8cdcf31879db5a8a7db43b1e60bd8e1b33e4e
No description provided.