You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/19 16:44:48 UTC
[doris] branch master updated: [fix](nereids) estimate TimeStampArithmetic (#15061)
This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new a84a590b4f [fix](nereids) estimate TimeStampArithmetic (#15061)
a84a590b4f is described below
commit a84a590b4fc948641ec9027679d4e8baed924585
Author: minghong <mi...@163.com>
AuthorDate: Tue Dec 20 00:44:42 2022 +0800
[fix](nereids) estimate TimeStampArithmetic (#15061)
`select * from lineitem where l_shipdate < date('1994-01-01') + interval '1' YEAR limit 1;`
cause stack overflow
---
.../org/apache/doris/nereids/stats/ExpressionEstimation.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java
index 9d4ed1ba95..494dfe9371 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java
@@ -28,6 +28,7 @@ import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.Multiply;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.expressions.Subtract;
+import org.apache.doris.nereids.trees.expressions.TimestampArithmetic;
import org.apache.doris.nereids.trees.expressions.VirtualSlotReference;
import org.apache.doris.nereids.trees.expressions.functions.BoundFunction;
import org.apache.doris.nereids.trees.expressions.functions.agg.Avg;
@@ -282,4 +283,14 @@ public class ExpressionEstimation extends ExpressionVisitor<ColumnStatistic, Sta
StatsDeriveResult context) {
return aggregateExpression.child().accept(this, context);
}
+
+ @Override
+ public ColumnStatistic visitTimestampArithmetic(TimestampArithmetic arithmetic, StatsDeriveResult context) {
+ ColumnStatistic colStat = arithmetic.child(0).accept(this, context);
+ ColumnStatisticBuilder builder = new ColumnStatisticBuilder(colStat);
+ builder.setMinValue(Double.MIN_VALUE);
+ builder.setMaxValue(Double.MAX_VALUE);
+ builder.setSelectivity(1.0);
+ return builder.build();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org