This is an automated email from the ASF dual-hosted git repository.

morrysnow 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 bdbce77227 [fix](nereids) cast left child of TimestampArithmetic to 
wrong type in BindFunction (#12423)
bdbce77227 is described below

commit bdbce77227d16a1fe731dc4aa55b108f291fd24d
Author: Kikyou1997 <33112463+kikyou1...@users.noreply.github.com>
AuthorDate: Wed Sep 7 20:32:47 2022 +0800

    [fix](nereids) cast left child of TimestampArithmetic to wrong type in 
BindFunction (#12423)
---
 .../main/java/org/apache/doris/nereids/rules/analysis/BindFunction.java | 2 +-
 .../org/apache/doris/nereids/trees/expressions/TimestampArithmetic.java | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindFunction.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindFunction.java
index 567d2169ff..d1a4a4cd2c 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindFunction.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindFunction.java
@@ -175,7 +175,7 @@ public class BindFunction implements AnalysisRuleFactory {
                 } catch (Exception e) {
                     // ignore
                 }
-                if (!left.getDataType().isDateType() && 
arithmetic.getTimeUnit().isDateTimeUnit()) {
+                if (!left.getDataType().isDateType() && 
!arithmetic.getTimeUnit().isDateTimeUnit()) {
                     left = arithmetic.left().castTo(DateType.INSTANCE);
                 }
             }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/TimestampArithmetic.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/TimestampArithmetic.java
index ec5c5ce02f..c288698451 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/TimestampArithmetic.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/TimestampArithmetic.java
@@ -36,6 +36,7 @@ import java.util.List;
  * Describes the addition and subtraction of time units from timestamps.
  * Arithmetic expressions on timestamps are syntactic sugar.
  * They are executed as function call exprs in the BE.
+ * Example: '1996-01-01' + INTERVAL '3' month;
  * TODO: we need to rethink this, and maybe need to add a new type of Interval 
then implement IntervalLiteral as others
  */
 public class TimestampArithmetic extends Expression implements 
BinaryExpression {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to