xzj7019 commented on code in PR #40654:
URL: https://github.com/apache/doris/pull/40654#discussion_r1759707814


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/JoinEstimation.java:
##########
@@ -177,14 +181,27 @@ private static double 
computeSelectivityForBuildSideWhenColStatsUnknown(Statisti
             if (cond instanceof EqualTo) {
                 EqualTo equal = (EqualTo) cond;
                 if (equal.left() instanceof Slot && equal.right() instanceof 
Slot) {
-                    ColumnStatistic buildColStats = 
buildStats.findColumnStatistics(equal.left());
-                    if (buildColStats == null) {
-                        buildColStats = 
buildStats.findColumnStatistics(equal.right());
+                    Slot buildSideSlot = null;
+                    if (buildStats.findColumnStatistics(equal.left()) != null) 
{
+                        buildSideSlot = (Slot) equal.left();
+                    } else if (buildStats.findColumnStatistics(equal.right()) 
!= null) {
+                        buildSideSlot = (Slot) equal.right();
                     }
-                    if (buildColStats != null) {
-                        double buildSel = Math.min(buildStats.getRowCount() / 
buildColStats.count, 1.0);
-                        buildSel = Math.max(buildSel, 
UNKNOWN_COL_STATS_FILTER_SEL_LOWER_BOUND);
-                        sel = Math.min(sel, buildSel);
+                    // the processing is mainly for olap table since external 
table rarely has column level statistics

Review Comment:
   it seems not easy to remove this part of count usage and since it is for 
no-stats, it can be remained for future use and the modification will be 
reverted.



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