|
84 | 84 | import static com.facebook.presto.SystemSessionProperties.isExperimentalFunctionsEnabled;
|
85 | 85 | import static com.facebook.presto.SystemSessionProperties.isListBuiltInFunctionsOnly;
|
86 | 86 | import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature;
|
87 |
| -import static com.facebook.presto.metadata.BuiltInTypeAndFunctionNamespaceManager.DEFAULT_NAMESPACE; |
| 87 | +import static com.facebook.presto.metadata.BuiltInTypeAndFunctionNamespaceManager.JAVA_BUILTIN_NAMESPACE; |
88 | 88 | import static com.facebook.presto.metadata.CastType.toOperatorType;
|
89 | 89 | import static com.facebook.presto.metadata.FunctionSignatureMatcher.constructFunctionNotFoundErrorMessage;
|
90 | 90 | import static com.facebook.presto.metadata.SessionFunctionHandle.SESSION_NAMESPACE;
|
@@ -142,11 +142,11 @@ public FunctionAndTypeManager(
|
142 | 142 | this.transactionManager = requireNonNull(transactionManager, "transactionManager is null");
|
143 | 143 | this.blockEncodingSerde = requireNonNull(blockEncodingSerde, "blockEncodingSerde is null");
|
144 | 144 | this.builtInTypeAndFunctionNamespaceManager = new BuiltInTypeAndFunctionNamespaceManager(blockEncodingSerde, functionsConfig, types, this);
|
145 |
| - this.functionNamespaceManagers.put(DEFAULT_NAMESPACE.getCatalogName(), builtInTypeAndFunctionNamespaceManager); |
| 145 | + this.functionNamespaceManagers.put(JAVA_BUILTIN_NAMESPACE.getCatalogName(), builtInTypeAndFunctionNamespaceManager); |
146 | 146 | this.functionInvokerProvider = new FunctionInvokerProvider(this);
|
147 | 147 | this.handleResolver = requireNonNull(handleResolver, "handleResolver is null");
|
148 | 148 | // TODO: Provide a more encapsulated way for TransactionManager to register FunctionNamespaceManager
|
149 |
| - transactionManager.registerFunctionNamespaceManager(DEFAULT_NAMESPACE.getCatalogName(), builtInTypeAndFunctionNamespaceManager); |
| 149 | + transactionManager.registerFunctionNamespaceManager(JAVA_BUILTIN_NAMESPACE.getCatalogName(), builtInTypeAndFunctionNamespaceManager); |
150 | 150 | this.functionCache = CacheBuilder.newBuilder()
|
151 | 151 | .recordStats()
|
152 | 152 | .maximumSize(1000)
|
@@ -247,7 +247,7 @@ public FunctionHandle lookupCast(String castType, Type fromType, Type toType)
|
247 | 247 | public QualifiedObjectName qualifyObjectName(QualifiedName name)
|
248 | 248 | {
|
249 | 249 | if (!name.getPrefix().isPresent()) {
|
250 |
| - return QualifiedObjectName.valueOf(DEFAULT_NAMESPACE, name.getSuffix()); |
| 250 | + return QualifiedObjectName.valueOf(JAVA_BUILTIN_NAMESPACE, name.getSuffix()); |
251 | 251 | }
|
252 | 252 | if (name.getOriginalParts().size() != 3) {
|
253 | 253 | throw new PrestoException(FUNCTION_NOT_FOUND, format("Functions that are not temporary or builtin must be referenced by 'catalog.schema.function_name', found: %s", name));
|
@@ -384,7 +384,7 @@ public Collection<SqlFunction> listBuiltInFunctions()
|
384 | 384 |
|
385 | 385 | public Collection<? extends SqlFunction> getFunctions(Session session, QualifiedObjectName functionName)
|
386 | 386 | {
|
387 |
| - if (functionName.getCatalogSchemaName().equals(DEFAULT_NAMESPACE) && |
| 387 | + if (functionName.getCatalogSchemaName().equals(JAVA_BUILTIN_NAMESPACE) && |
388 | 388 | SessionFunctionUtils.listFunctionNames(session.getSessionFunctions()).contains(functionName.getObjectName())) {
|
389 | 389 | return SessionFunctionUtils.getFunctions(session.getSessionFunctions(), functionName);
|
390 | 390 | }
|
@@ -442,7 +442,7 @@ public FunctionHandle resolveFunction(
|
442 | 442 | QualifiedObjectName functionName,
|
443 | 443 | List<TypeSignatureProvider> parameterTypes)
|
444 | 444 | {
|
445 |
| - if (functionName.getCatalogSchemaName().equals(DEFAULT_NAMESPACE)) { |
| 445 | + if (functionName.getCatalogSchemaName().equals(JAVA_BUILTIN_NAMESPACE)) { |
446 | 446 | if (sessionFunctions.isPresent()) {
|
447 | 447 | Collection<SqlFunction> candidates = SessionFunctionUtils.getFunctions(sessionFunctions.get(), functionName);
|
448 | 448 | Optional<Signature> match = functionSignatureMatcher.match(candidates, parameterTypes, true);
|
@@ -698,7 +698,7 @@ private FunctionHandle resolveFunctionInternal(Optional<TransactionId> transacti
|
698 | 698 |
|
699 | 699 | private FunctionHandle resolveBuiltInFunction(QualifiedObjectName functionName, List<TypeSignatureProvider> parameterTypes)
|
700 | 700 | {
|
701 |
| - checkArgument(functionName.getCatalogSchemaName().equals(DEFAULT_NAMESPACE), "Expect built-in functions"); |
| 701 | + checkArgument(functionName.getCatalogSchemaName().equals(JAVA_BUILTIN_NAMESPACE), "Expect built-in functions"); |
702 | 702 | checkArgument(parameterTypes.stream().noneMatch(TypeSignatureProvider::hasDependency), "Expect parameter types not to have dependency");
|
703 | 703 | return resolveFunctionInternal(Optional.empty(), functionName, parameterTypes);
|
704 | 704 | }
|
|
0 commit comments