This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0abe5db29bb51c8b6c6e24daf276327167145f90 Author: Gabriel <[email protected]> AuthorDate: Fri May 19 16:44:36 2023 +0800 [Bug](decimal) fix variance_samp and avg_weighted #19861 --- .../java/org/apache/doris/analysis/FunctionCallExpr.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java index c9f25a3f8b..8e3ac7a1f6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java @@ -69,8 +69,8 @@ import java.util.Set; public class FunctionCallExpr extends Expr { public static final ImmutableSet<String> STDDEV_FUNCTION_SET = new ImmutableSortedSet.Builder( String.CASE_INSENSITIVE_ORDER) - .add("stddev").add("stddev_val").add("stddev_samp").add("stddev_pop") - .add("variance").add("variance_pop").add("variance_pop").add("var_samp").add("var_pop").build(); + .add("stddev").add("stddev_val").add("stddev_samp").add("stddev_pop").add("variance").add("variance_pop") + .add("variance_pop").add("var_samp").add("var_pop").add("variance_samp").add("avg_weighted").build(); public static final Map<String, java.util.function.BiFunction<ArrayList<Expr>, Type, Type>> PRECISION_INFER_RULE; public static final java.util.function.BiFunction<ArrayList<Expr>, Type, Type> DEFAULT_PRECISION_INFER_RULE; public static final ImmutableSet<String> ROUND_FUNCTION_SET = new ImmutableSortedSet.Builder( @@ -1246,10 +1246,13 @@ public class FunctionCallExpr extends Expr { System.arraycopy(childTypes, 0, newChildTypes, 0, newChildTypes.length); fn = getBuiltinFunction(fnName.getFunction(), newChildTypes, Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF); - } else if (STDDEV_FUNCTION_SET.contains(fnName.getFunction().toLowerCase()) && children.size() == 1 + } else if (STDDEV_FUNCTION_SET.contains(fnName.getFunction().toLowerCase()) && collectChildReturnTypes()[0].isDecimalV3()) { - fn = getBuiltinFunction(fnName.getFunction(), new Type[] { Type.DOUBLE }, - Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF); + Type[] childrenTypes = collectChildReturnTypes(); + Type[] args = new Type[childrenTypes.length]; + args[0] = Type.DOUBLE; + System.arraycopy(childrenTypes, 1, args, 1, childrenTypes.length - 1); + fn = getBuiltinFunction(fnName.getFunction(), args, Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF); } else { // now first find table function in table function sets if (isTableFnCall) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
