924060929 commented on code in PR #12163:
URL: https://github.com/apache/doris/pull/12163#discussion_r958399631


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/TimestampArithmeticExpr.java:
##########
@@ -86,6 +86,39 @@ public TimestampArithmeticExpr(ArithmeticExpr.Operator op, 
Expr e1, Expr e2,
         children.add(e2);
     }
 
+    /**
+     * used for Nereids ONLY.
+     * C'tor for function-call like arithmetic, e.g., 'date_add(a, interval b 
year)'.

Review Comment:
   I suggest add the comment what is the parameter value is.
   e.g
   ```java
   // C'tor for function-call like arithmetic, e.g., 'date_add(a, interval b 
year)'
   // which
   // funcName: `date_add`
   // e1: `a`
   // e2: `b`
   // timeUnitIdent: 'year'
   // dataType: ???
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/TimestampArithmeticExpr.java:
##########
@@ -86,6 +86,39 @@ public TimestampArithmeticExpr(ArithmeticExpr.Operator op, 
Expr e1, Expr e2,
         children.add(e2);
     }
 
+    /**
+     * used for Nereids ONLY.
+     * C'tor for function-call like arithmetic, e.g., 'date_add(a, interval b 
year)'.
+     */
+    public TimestampArithmeticExpr(String funcName, Expr e1, Expr e2, String 
timeUnitIdent, Type dataType) {
+        this.funcName = funcName;
+        this.timeUnitIdent = timeUnitIdent;
+        this.timeUnit = TIME_UNITS_MAP.get(timeUnitIdent);
+        this.intervalFirst = false;
+        children.add(e1);
+        children.add(e2);
+        this.type = dataType;
+    }
+
+    /**
+     * used for Nereids ONLY.
+     * C'tor for non-function-call like arithmetic, e.g., 'a + interval b 
year'.
+     * e1 always refers to the timestamp to be added/subtracted from, and e2
+     * to the time value (even in the interval-first case).
+     */

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to