This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 2b3db8f2a8 [Bug](functions) Fix functions for array type with nested
decimalv3 (#19993)
2b3db8f2a8 is described below
commit 2b3db8f2a861db935bc62a25a6a45a663fb0f6f8
Author: Gabriel <[email protected]>
AuthorDate: Wed May 24 16:51:34 2023 +0800
[Bug](functions) Fix functions for array type with nested decimalv3 (#19993)
---
.../java/org/apache/doris/analysis/FunctionCallExpr.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 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 adffa17b2a..a8551d5aa1 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
@@ -1423,6 +1423,11 @@ public class FunctionCallExpr extends Expr {
}
fn = getBuiltinFunction(fnName.getFunction(), argTypes,
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
+ } else if (fnName.getFunction().equalsIgnoreCase("array_apply")
+ && ((ArrayType)
children.get(0).getType()).getItemType().isDecimalV3()) {
+ uncheckedCastChild(((ArrayType)
children.get(0).getType()).getItemType(), 2);
+ fn = getBuiltinFunction(fnName.getFunction(),
collectChildReturnTypes(),
+ Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
} else if
(AggregateFunction.SUPPORT_ORDER_BY_AGGREGATE_FUNCTION_NAME_SET.contains(
fnName.getFunction().toLowerCase())) {
// order by elements add as child like windows function. so if we
get the
@@ -1657,9 +1662,9 @@ public class FunctionCallExpr extends Expr {
&& ((ArrayType)
args[ix]).getItemType().isDecimalV3()))) {
continue;
} else if (!argTypes[i].matchesType(args[ix])
- &&
(!fn.getReturnType().isDecimalV3OrContainsDecimalV3()
- || (argTypes[i].isValid() &&
!argTypes[i].isDecimalV3() && args[ix].isDecimalV3()))) {
- // || (argTypes[i].isValid() &&
argTypes[i].getPrimitiveType() != args[ix].getPrimitiveType()))) {
+ && !(argTypes[i].isDecimalV3OrContainsDecimalV3()
+ && args[ix].isDecimalV3OrContainsDecimalV3())) {
+ // Do not do this cast if types are both decimalv3 with
different precision/scale.
uncheckedCastChild(args[ix], i);
}
}
@@ -1774,6 +1779,8 @@ public class FunctionCallExpr extends Expr {
newFields.add(new StructField(fieldType));
}
this.type = new StructType(newFields);
+ } else if (fnName.getFunction().equalsIgnoreCase("topn_array")) {
+ this.type = new ArrayType(children.get(0).getType());
} else if (fnName.getFunction().equalsIgnoreCase("array_distinct") ||
fnName.getFunction()
.equalsIgnoreCase("array_remove") ||
fnName.getFunction().equalsIgnoreCase("array_sort")
|| fnName.getFunction().equalsIgnoreCase("array_reverse_sort")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]