bowenli86 commented on a change in pull request #10388: [FLINK-14912][Table]
create, drop catalog functions through catalog manager
URL: https://github.com/apache/flink/pull/10388#discussion_r353460278
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/internal/TableEnvImpl.scala
##########
@@ -613,24 +617,74 @@ abstract class TableEnvImpl(
.map(_.getTable)
}
+ private def createCatalogFunction(createFunctionOperation:
CreateFunctionOperation)= {
+ val objectIdentifier = createFunctionOperation.getFunctionIdentifier
+ val catalogOptional = CatalogFunctionUtils.lookupCatalog(
+ catalogManager, objectIdentifier,
!createFunctionOperation.isIgnoreIfExists)
+
+ if (catalogOptional.isPresent) {
+ try catalogOptional.get().createFunction(
+ createFunctionOperation.getFunctionIdentifier.toObjectPath,
+ createFunctionOperation.getCatalogFunction,
+ createFunctionOperation.isIgnoreIfExists)
+ catch {
+ case e: Exception =>
+ new TableException("Fail to create catalog function", e)
+ }
+ }
+ }
+
+ private def alterCatalogFunction(alterFunctionOperation:
AlterFunctionOperation) = {
+ val objectIdentifier = alterFunctionOperation.getFunctionIdentifier
+ val catalogOptional = CatalogFunctionUtils.lookupCatalog(
+ catalogManager, objectIdentifier, !alterFunctionOperation.isIfExists)
+
+ if (catalogOptional.isPresent) {
+ try catalogOptional.get().createFunction(
+ alterFunctionOperation.getFunctionIdentifier.toObjectPath,
+ alterFunctionOperation.getCatalogFunction,
+ alterFunctionOperation.isIfExists)
+ catch {
+ case e: Exception =>
+ new TableException("Fail to alter catalog function", e)
+ }
+ }
+ }
+
+ private def dropCatalogFunction(dropFunctionOperation:
DropFunctionOperation) = {
+ val objectIdentifier = dropFunctionOperation.getFunctionIdentifier
+ val catalogOptional = CatalogFunctionUtils.lookupCatalog(
+ catalogManager, objectIdentifier, !dropFunctionOperation.isIfExists)
+
+ if (catalogOptional != null) {
Review comment:
ditto
----------------------------------------------------------------
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