morrySnow commented on code in PR #19863:
URL: https://github.com/apache/doris/pull/19863#discussion_r1210292615


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Expression.java:
##########
@@ -49,6 +51,7 @@
  * Abstract class for all Expression in Nereids.
  */
 public abstract class Expression extends AbstractTreeNode<Expression> 
implements ExpressionTrait {
+    private static final Set<String> foldableLeafExpression = 
ImmutableSet.of("current_time", "current_date");

Review Comment:
   i think u should add a interface named Foldable and let CurrentTime and 
CurrentDate implement it



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java:
##########
@@ -49,6 +49,7 @@ public enum ExpressionEvaluator {
     INSTANCE;
 
     private ImmutableMultimap<String, FunctionInvoker> functions;
+    // the not eval non-empty arguments datetime function

Review Comment:
   what the comment mean?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java:
##########
@@ -448,18 +449,17 @@ public static Expression fromUnixTime(IntegerLiteral 
second, VarcharLiteral form
                 .plusSeconds(second.getValue())
                 .atZone(ZoneId.of("UTC+0"))
                 .toOffsetDateTime()
-                .atZoneSameInstant(ZoneId.systemDefault());
+                .atZoneSameInstant(getTimeZone());
         return dateFormat(new DateTimeLiteral(dateTime.getYear(), 
dateTime.getMonthValue(),
                         dateTime.getDayOfMonth(), dateTime.getHour(), 
dateTime.getMinute(), dateTime.getSecond()),
                 format);
     }
 
-    /**
-     * date transformation function: unix_timestamp
-     */
-    @ExecFunction(name = "unix_timestamp", argTypes = {}, returnType = "INT")
-    public static Expression unixTimestamp() {
-        return new IntegerLiteral(getTimestamp(LocalDateTime.now()));
+    public static ZoneId getTimeZone() {
+        if (ConnectContext.get() == null || 
ConnectContext.get().getSessionVariable() == null) {
+            return ZoneId.systemDefault();
+        }
+        return 
ZoneId.of(ConnectContext.get().getSessionVariable().getTimeZone());

Review Comment:
   why we have two same function in two different files?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to