Support CREATE FUNCTION execution#13561
Conversation
1bee024 to
d9a8110
Compare
|
@rongrong Thanks for the review! |
presto-spi/src/main/java/com/facebook/presto/spi/function/FunctionNamespaceManager.java
Outdated
Show resolved
Hide resolved
rongrong
left a comment
There was a problem hiding this comment.
Looks good. Mostly nits.
presto-main/src/main/java/com/facebook/presto/metadata/FunctionManager.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I think I mentioned before that getSuffix is more accurate than getUnqualifiedName. If you prefer to use "unqualified name", it's more appropriate to have a utility function unqualifyName(qualifiedName). I'm not sure whether you can call the last part of a qualified name "unqualified name".
There was a problem hiding this comment.
It is a convention to called the last part of a "fully qualified object" (file path, class name, etc) a unqualified name. Here are some reference:
Because we're defining a specialized class for a fully-qualified function name, it sounds weird to me that it consists of (functionNamespace, suffix)
There was a problem hiding this comment.
Again, those reference only said a name without prefix is a unqualified name, rather than saying the last part of a qualified name is a "unqualified name". The reference you mentioned also used "suffix", which I still think is better than "unqualified name". If you want to be stubborn on this I won't insist. But I think "suffix" is better than "unqualified name" in this case.
There was a problem hiding this comment.
Looking at some of our existing classes:
QualifiedObjectNameis defined as(catalogName, schemaName, objectName).QualifiedTablePrefixis defined as(catalogName, schemaName, tableName).
What about defining QualifiedFunctionName as (functionNamespace, functionName)?
There was a problem hiding this comment.
That should be defined as (CatalogSchemaName functionNamespace, String suffix) then.
presto-spi/src/main/java/com/facebook/presto/spi/function/SqlFunctionHandle.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/facebook/presto/sqlfunction/AbstractSqlInvokedFunctionNamespaceManager.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/execution/CreateFunctionTask.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/execution/CreateFunctionTask.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/metadata/FunctionManager.java
Outdated
Show resolved
Hide resolved
rongrong
left a comment
There was a problem hiding this comment.
Add some tests to AbstractTestQueries, including explainDdl.
presto-main/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/execution/CreateFunctionTask.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/execution/CreateFunctionTask.java
Outdated
Show resolved
Hide resolved
rongrong
left a comment
There was a problem hiding this comment.
Please add some tests to AbstractTestQueries and address remaining comments.
|
Added explainDdl test. |
Use CatalogSchemaName to represent function namespace. Also - Fix a bug in getServingFunctionNamespaceManager to correctly return the most exact match instead of the least exact match. - Throw PrestoException when resolving non-builtin functions with a QualifiedName with not exactly 3 parts.
Also - Make SqlInvokedFunction the parameter type for createFunction. - Store SqlFunctionId within SqlFunctionHandle. - Convert SqlInvokedFunction#versioned to instance method.
Also rename the class to SqlInvokedFunctionTestUtils
Rollback is not supported by Presto transactions.
|
There was a problem hiding this comment.
Isn't it simpler to put all names in a set and check the size?
There was a problem hiding this comment.
I need the duplicate parameter names to construct a user-friendly error message, but size checking won't tell me what are duplicated.
Alternatively, printing one name instead of a list is fine with me as well, but I don't think that will make the code simpler.
There was a problem hiding this comment.
I'd just print the whole parameter list lol but sure.
presto-main/src/main/java/com/facebook/presto/sql/analyzer/SemanticErrorCode.java
Outdated
Show resolved
Hide resolved
|
Thanks for working on this! Looking forward to see this in production! |
Uh oh!
There was an error while loading. Please reload this page.