Skip to content

Commit d89c911

Browse files
committed
Retrieve UDF implementations from external registry first to allow data-storage-dependent overriding
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent 3b983a2 commit d89c911

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

core/src/main/java/org/opensearch/sql/expression/function/PPLFuncImpTable.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,13 @@ public RexNode resolve(final RexBuilder builder, final String functionName, RexN
152152

153153
public RexNode resolve(
154154
final RexBuilder builder, final BuiltinFunctionName functionName, RexNode... args) {
155+
// Check the external function registry first. This allows the data-storage-dependent
156+
// function implementations to override the internal ones with the same name.
155157
List<Pair<CalciteFuncSignature, FunctionImp>> implementList =
156-
functionRegistry.get(functionName);
157-
// If the function is not part of the built-in registry, check the external registry
158+
externalFunctionRegistry.get(functionName);
159+
// If the function is not part of the external registry, check the internal registry.
158160
if (implementList == null) {
159-
implementList = externalFunctionRegistry.get(functionName);
161+
implementList = functionRegistry.get(functionName);
160162
}
161163
if (implementList == null || implementList.isEmpty()) {
162164
throw new IllegalStateException(String.format("Cannot resolve function: %s", functionName));

0 commit comments

Comments
 (0)