xinyiZzz commented on a change in pull request #8745:
URL: https://github.com/apache/incubator-doris/pull/8745#discussion_r841032028
##########
File path: fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java
##########
@@ -223,6 +227,20 @@ public static RuntimeFilter
create(IdGenerator<RuntimeFilterId> idGen, Analyzer
if (LOG.isTraceEnabled()) {
LOG.trace("Generating runtime filter from predicate " +
joinPredicate);
}
+ if
(ConnectContext.get().getSessionVariable().enableRemoveNoConjunctsRuntimeFilterPolicy)
{
+ if (srcExpr instanceof SlotRef) {
+ if (!tupleHasConjuncts.contains(((SlotRef)
srcExpr).getDesc().getParent().getId())) {
+ // src tuple has no conjunct, don't create runtime filter
+ return null;
+ } else {
+ // runtime filter itself is a valid conjunct, add all the
target tuple ids
+ for (TupleId tupleId: targetSlots.keySet()) {
+ tupleHasConjuncts.add(tupleId);
Review comment:
I don't understand why `targetSlots::tupleID` is put into
`tupleHasConjuncts`, can you explain, thx.
##########
File path:
fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilterGenerator.java
##########
@@ -181,7 +203,7 @@ public static void generateRuntimeFilters(Analyzer
analyzer, PlanNode plan) {
* In the bottom-up traversal of the plan tree, the filters are assigned
to destination
* (scan) nodes. Filters that cannot be assigned to a scan node are
discarded.
*/
- private void generateFilters(PlanNode root) {
+ private void generateFilters(PlanNode root, HashSet<TupleId>
tupleHasConjuncts) {
Review comment:
Make `tupleHasConjuncts` a member variable of `RuntimeFilterGenerator`
to avoid passing it frequently.
##########
File path:
fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilterGenerator.java
##########
@@ -122,6 +122,24 @@ private RuntimeFilterGenerator(Analyzer analyzer) {
bloomFilterSizeLimits = new FilterSizeLimits(sessionVariable);
}
+ static class HasConjunctPredicate implements
com.google.common.base.Predicate<PlanNode> {
+ @Override
+ public boolean apply(PlanNode arg) {
+ // for simplicity, skip join node( which contains more than 1
tuple id )
+ return arg.getTupleIds().size() == 1 && !arg.conjuncts.isEmpty();
+ }
+ }
+
+ private static HashSet<TupleId> collectAllTupleIdsHavingConjunct(PlanNode
rootNode) {
+ HashSet<TupleId> tupleIds = new HashSet<>();
+ List<PlanNode> nodes = Lists.newArrayList();
+ rootNode.collectAll(new HasConjunctPredicate(), nodes);
Review comment:
Replace `nodes` with `RuntimeFilterGenerator::tupleHasConjuncts` , which
condenses `collectAllTupleIdsHavingConjunct` into one line of code and puts it
into `generateRuntimeFilters`.
##########
File path:
fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilterGenerator.java
##########
@@ -122,6 +122,24 @@ private RuntimeFilterGenerator(Analyzer analyzer) {
bloomFilterSizeLimits = new FilterSizeLimits(sessionVariable);
}
+ static class HasConjunctPredicate implements
com.google.common.base.Predicate<PlanNode> {
+ @Override
+ public boolean apply(PlanNode arg) {
+ // for simplicity, skip join node( which contains more than 1
tuple id )
+ return arg.getTupleIds().size() == 1 && !arg.conjuncts.isEmpty();
Review comment:
Returns the tuple id that satisfies the condition.
--
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]