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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java:
##########
@@ -737,8 +738,9 @@ public String toString() {
             builder.append("\n\n").append(group);
             builder.append("  
stats=").append(group.getStatistics()).append("\n");
             Statistics stats = group.getStatistics();
+            Plan plan = group.getLogicalExpressions().get(0).getPlan();

Review Comment:
   get(0).getPlan could lead to NPE, should put into branch `stats != null && 
!group.getLogicalExpressions().isEmpty()`



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java:
##########
@@ -140,12 +143,38 @@ public ColumnStatistic visitCaseWhen(CaseWhen caseWhen, 
Statistics context) {
         return columnStat.build();
     }
 
+    @Override
     public ColumnStatistic visitCast(Cast cast, Statistics context) {
         ColumnStatistic stats = context.findColumnStatistics(cast);
         if (stats != null) {
             return stats;
         }
-        return cast.child().accept(this, context);
+        ColumnStatistic childColStats = cast.child().accept(this, context);
+
+        return castMinMax(childColStats, cast.getDataType());
+    }
+
+    private ColumnStatistic castMinMax(ColumnStatistic colStats, DataType 
targetType) {
+        if (colStats.minExpr instanceof StringLiteral && 
targetType.isDateLikeType()) {

Review Comment:
   should we process other type cast?



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