englefly commented on code in PR #18118:
URL: https://github.com/apache/doris/pull/18118#discussion_r1148732212
##########
fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java:
##########
@@ -132,7 +132,7 @@ public void testNotInNaN() {
Statistics stat = new Statistics(1000, slotToColumnStat);
FilterEstimation filterEstimation = new FilterEstimation();
Statistics expected = filterEstimation.estimate(notIn, stat);
- Assertions.assertTrue(Precision.equals(333.33, expected.getRowCount(),
0.01));
+ Assertions.assertTrue(Precision.equals(666.666,
expected.getRowCount(), 0.01));
Review Comment:
I have some questions about this UT
1. why isUnknown=true In line 130
2. we do not modify the algorithm, why case result changed?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java:
##########
@@ -331,22 +317,41 @@ A not in (1, 2, 3, 100):
}
@Override
- public Statistics visitNot(Not not, EstimationContext none) {
- Preconditions.checkState(!(not.child() instanceof Not),
- "Consecutive Not statement should be merged previously");
- EstimationContext context = new EstimationContext(true,
none.statistics);
- return not.child().accept(this, context);
+ public Statistics visitNot(Not not, EstimationContext context) {
+ Statistics childStats = new FilterEstimation().estimate(not.child(),
context.statistics);
+ double rowCount = Math.max(context.statistics.getRowCount() -
childStats.getRowCount(), 0);
+ if (rowCount == 0.0) {
+ return Statistics.zero(context.statistics);
Review Comment:
it is better to return at least one tuple, not Zero.
##########
fe/fe-core/src/test/java/org/apache/doris/statistics/StatsDeriveResultTest.java:
##########
@@ -37,7 +37,7 @@ public void testUpdateRowCountByLimit() {
Assertions.assertEquals(0, resColStats.ndv);
Assertions.assertEquals(1, resColStats.avgSizeByte);
Assertions.assertEquals(0, resColStats.numNulls);
- Assertions.assertEquals(0, resColStats.dataSize);
+ Assertions.assertEquals(1, resColStats.dataSize);
Review Comment:
why case result changed?
--
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]