This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
new 7b7e61d8c7 [Bug](date) Fix wrong type in TimestampArithmeticExpr
(#12869)
7b7e61d8c7 is described below
commit 7b7e61d8c7e24f8f99595dc6f8c4f4b63ef4815b
Author: Gabriel <[email protected]>
AuthorDate: Fri Sep 23 08:51:31 2022 +0800
[Bug](date) Fix wrong type in TimestampArithmeticExpr (#12869)
---
.../apache/doris/analysis/TimestampArithmeticExpr.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/TimestampArithmeticExpr.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TimestampArithmeticExpr.java
index c04f16c6b8..26b0a82425 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/TimestampArithmeticExpr.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TimestampArithmeticExpr.java
@@ -213,8 +213,21 @@ public class TimestampArithmeticExpr extends Expr {
(op == ArithmeticExpr.Operator.ADD) ? "ADD" : "SUB");
}
- fn = getBuiltinFunction(analyzer, funcOpName.toLowerCase(),
- collectChildReturnTypes(),
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
+ Type[] childrenTypes = collectChildReturnTypes();
+ fn = getBuiltinFunction(funcOpName.toLowerCase(), childrenTypes,
+ Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
+ Preconditions.checkArgument(fn != null);
+ Type[] argTypes = fn.getArgs();
+ if (argTypes.length > 0) {
+ // Implicitly cast all the children to match the function if
necessary
+ for (int i = 0; i < childrenTypes.length; ++i) {
+ // For varargs, we must compare with the last type in
callArgs.argTypes.
+ int ix = Math.min(argTypes.length - 1, i);
+ if (!childrenTypes[i].matchesType(argTypes[ix]) && !(
+ childrenTypes[i].isDateType() &&
argTypes[ix].isDateType())) {
+ uncheckedCastChild(argTypes[ix], i);
+ }
+ }
LOG.debug("fn is {} name is {}", fn, funcOpName);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]