englefly commented on code in PR #66906:
URL: https://github.com/apache/doris/pull/66906#discussion_r3826983568


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java:
##########
@@ -1210,6 +1211,30 @@ public static boolean 
unionConstExprsSatisfyConjuncts(LogicalUnion union, Set<Ex
         return true;
     }
 
+    /**
+     * Try to substitute the uniform constant values of {@code childTrait} 
into {@code expr}. If all
+     * input slots of {@code expr} have a known uniform constant value in 
{@code childTrait} and the
+     * substituted expression is a constant, return it. e.g. for a project 
expression
+     * `days_sub(begin_time, 1)` over a child where `begin_time` is a uniform 
constant slot, returns
+     * `days_sub('2026-07-28 00:00:00', 1)`, so the projected slot can also be 
registered as a
+     * uniform constant and downstream constant propagation can fold 
predicates over it.
+     */
+    public static Optional<Expression> 
foldToConstantByUniformValues(Expression expr, DataTrait childTrait) {

Review Comment:
    `days_sub(begin_time, 1)`  fold 成了 days_sub('2026-07-28 00:00:00', 1)



-- 
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