HuangZhenQiu commented on a change in pull request #10476: [FLINK-14911]
[table] register and drop temp catalog functions from D…
URL: https://github.com/apache/flink/pull/10476#discussion_r355068542
##########
File path:
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -729,13 +738,33 @@ private void registerTableSinkInternal(String name,
TableSink<?> tableSink) {
}
private void createCatalogFunction(CreateFunctionOperation
createFunctionOperation) {
- Catalog catalog =
getCatalogOrThrowException(createFunctionOperation.getFunctionIdentifier().getCatalogName());
String exMsg =
getDDLOpExecuteErrorMsg(createFunctionOperation.asSummaryString());
try {
- catalog.createFunction(
-
createFunctionOperation.getFunctionIdentifier().toObjectPath(),
- createFunctionOperation.getCatalogFunction(),
- createFunctionOperation.isIgnoreIfExists());
+ CatalogFunction function =
createFunctionOperation.getCatalogFunction();
+ if (function.isTemporary()) {
+ boolean exist =
functionCatalog.hasTemporaryCatalogFunction(
+
createFunctionOperation.getFunctionIdentifier());
+ if (!exist) {
+ FunctionDefinition functionDefinition =
FunctionDefinitionUtil.createFunctionDefinition(
+
createFunctionOperation.getFunctionName(),
+ function);
+ registerFunctionInFunctionCatalog(
+
createFunctionOperation.getFunctionIdentifier(),
+ functionDefinition);
+ } else if
(!createFunctionOperation.isIgnoreIfExists()) {
+ throw new
FunctionAlreadyExistException(FunctionCatalog.TEMPORARY_CATALOG,
Review comment:
Agree. I will change to Validation Exception here.
----------------------------------------------------------------
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