in zetasql-toolkit-bigquery/src/main/java/com/google/zetasql/toolkit/catalog/bigquery/BigQueryCatalog.java [361:386]
public void register(FunctionInfo function, CreateMode createMode, CreateScope createScope) {
List<String> functionNamePath = function.getNamePath();
String fullName = String.join(".", functionNamePath);
this.validateCreateScope(
createScope,
ImmutableList.of(CreateScope.CREATE_DEFAULT_SCOPE, CreateScope.CREATE_TEMP),
fullName,
"function");
this.validateNamePathForCreation(functionNamePath, createScope, "function");
FunctionInfo resolvedFunction =
FunctionResultTypeResolver.resolveFunctionReturnTypes(
function, BigQueryLanguageOptions.get(), this.catalog);
List<String> catalogNamesForFunction = buildCatalogNamesForResource(fullName);
try {
catalogNamesForFunction.forEach(
catalogName ->
CatalogOperations.createFunctionInCatalog(
catalog, catalogName, resolvedFunction, createMode));
} catch (CatalogResourceAlreadyExists alreadyExists) {
throw this.addCaseInsensitivityWarning(alreadyExists);
}
}