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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java:
##########
@@ -121,11 +123,23 @@ public class ExpressionEstimation extends 
ExpressionVisitor<ColumnStatistic, Sta
      * returned columnStat is newly created or a copy of stats
      */
     public static ColumnStatistic estimate(Expression expression, Statistics 
stats) {
-        ColumnStatistic columnStatistic = expression.accept(INSTANCE, stats);
-        if (columnStatistic == null) {
-            return ColumnStatistic.UNKNOWN;
+        try {
+            ColumnStatistic columnStatistic = expression.accept(INSTANCE, 
stats);
+            if (columnStatistic == null) {
+                return ColumnStatistic.UNKNOWN;

Review Comment:
   this is copied from original codes.
   yes, it is better to set size.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -301,13 +301,33 @@ public static void estimate(GroupExpression 
groupExpression, CascadesContext con
 
     private void estimate() {
         Plan plan = groupExpression.getPlan();
-        Statistics newStats = plan.accept(this, null);
+        Statistics newStats;
+        try {
+            newStats = plan.accept(this, null);
+        } catch (Exception e) {
+            // throw exception in debug mode
+            if (ConnectContext.get() != null && 
ConnectContext.get().getSessionVariable().feDebug) {
+                throw e;
+            }
+            LOG.warn("stats calculation failed, plan " + plan.treeString(), e);

Review Comment:
   The reason for printing the plan tree is based on the following 
considerations:
   1. The plan tree is only printed when there is an error, and errors rarely 
occur here.
   2. If we have a complete plan tree, it will be convenient for us to locate 
the problem more quickly, without the need to execute “explain physical plan” 
again, especially in POC.



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