You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "englefly (via GitHub)" <gi...@apache.org> on 2023/04/14 06:11:41 UTC

[GitHub] [doris] englefly commented on a diff in pull request #18596: [enhancement](Nereids) optimize bloom filter size reducing strategy

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java:
##########
@@ -111,8 +114,21 @@ public PhysicalPlan visitPhysicalHashJoin(PhysicalHashJoin<? extends Plan, ? ext
                         continue;
                     }
                     Slot olapScanSlot = aliasTransferMap.get(unwrappedSlot).second;
+                    long buildSideNdv = -1L;
+                    AbstractPlan right = (AbstractPlan) join.right();
+                    if (right.getStats() != null) {
+                        List<Double> ndvs = join.getHashJoinConjuncts().stream()
+                                .map(Expression::getInputSlots)
+                                .flatMap(Set::stream)
+                                .filter(s -> right.getOutputExprIdSet().contains(s.getExprId()))
+                                .map(s -> right.getStats().columnStatistics().get(s))
+                                .filter(Objects::nonNull)
+                                .map(cs -> cs.ndv)
+                                .collect(Collectors.toList());
+                        buildSideNdv = (long) StatsMathUtil.multiNdv(ndvs);

Review Comment:
   buildSideNdv should be less than build side row count.
   buildSideNdv = Math.max(buildSideNdv, rowCount)



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