You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "morrySnow (via GitHub)" <gi...@apache.org> on 2023/07/12 17:00:46 UTC

[GitHub] [doris] morrySnow commented on a diff in pull request #21772: string to date min max

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: commits-unsubscribe@doris.apache.org

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


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