diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java index 049fff4898..ffb11b6015 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java @@ -66,6 +66,8 @@ public class FunctionSet { // Including now(), curdate(), etc.. private ImmutableSet nondeterministicFunctions; + private boolean inited = false; + public FunctionSet() { functions = Maps.newHashMap(); vectorizedFunctions = Maps.newHashMap(); @@ -90,6 +92,8 @@ public class FunctionSet { // init table function initTableFunction(); + + inited = true; } public void buildNullResultWithOneNullParamFunction(Set funcNames) { @@ -1249,7 +1253,7 @@ public class FunctionSet { // then specialize template functions and try them List specializedTemplateFunctions = Lists.newArrayList(); for (Function f : templateFunctions) { - f = FunctionSet.specializeTemplateFunction(f, desc, false); + f = specializeTemplateFunction(f, desc, false); if (f != null) { specializedTemplateFunctions.add(f); } @@ -1264,7 +1268,7 @@ public class FunctionSet { // then specialize variadic template function and try them List specializedVariadicTemplateFunctions = Lists.newArrayList(); for (Function f : variadicTemplateFunctions) { - f = FunctionSet.specializeTemplateFunction(f, desc, true); + f = specializeTemplateFunction(f, desc, true); if (f != null) { specializedVariadicTemplateFunctions.add(f); } @@ -1314,7 +1318,7 @@ public class FunctionSet { return null; } - public static Function specializeTemplateFunction(Function templateFunction, Function requestFunction, boolean isVariadic) { + public Function specializeTemplateFunction(Function templateFunction, Function requestFunction, boolean isVariadic) { try { boolean hasTemplateType = false; LOG.debug("templateFunction signature: " + templateFunction.signatureString() @@ -1352,7 +1356,8 @@ public class FunctionSet { specializedFunction = new ScalarFunction(f.getFunctionName(), newArgTypes, newRetType.get(0), f.hasVarArgs(), f.getSymbolName(), f.getBinaryType(), f.isUserVisible(), f.isVectorized(), f.getNullableMode()); } else { - // TODO(xk) + throw new TypeException(templateFunction + + " is not support for template since it's not a ScalarFunction"); } Type[] args = specializedFunction.getArgs(); Map specializedTypeMap = Maps.newHashMap(); @@ -1372,7 +1377,9 @@ public class FunctionSet { + " return: " + specializedFunction.getReturnType()); return hasTemplateType ? specializedFunction : templateFunction; } catch (TypeException e) { - LOG.warn("specializeTemplateFunction exception", e); + if (inited) { + LOG.warn("specializeTemplateFunction exception", e); + } return null; } }