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/03/10 13:41:46 UTC

[GitHub] [doris] englefly commented on a diff in pull request #17653: [refactor](Nereids): refactor Join-Dependent Predicate Duplication.

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/ExtractSingleTableExpressionFromDisjunction.java:
##########
@@ -35,109 +34,87 @@
 import java.util.stream.Collectors;
 
 /**
+ * Paper: Quantifying TPC-H Choke Points and Their Optimizations
+ * 4.4 Join-Dependent Predicate Duplication
  * Example:
- * (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY') or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE')
+ * Two queries, Q7 and Q19, include predicates that operate
+ * on multiple tables without being a join predicate. In Q17,
+ * (n1.name = ’NATION1’ AND n2.name = ’NATION2’) OR (n1.name = ’NATION2’ AND n2.name = ’NATION1’)
  * =>
  * (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY') or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE')
  * and (n1.n_name = 'FRANCE' or n1.n_name='GERMANY') and (n2.n_name='GERMANY' or n2.n_name='FRANCE')
- *
- * (n1.n_name = 'FRANCE' or n1.n_name='GERMANY') is a logical redundant, but it could be pushed down to scan(n1) to
- * reduce the number of scan output tuples.
- * For complete sql example, refer to tpch q7.
- * ==================================================================================================
- * <br/>
- * There are 2 cases, in which the redundant expressions are useless:
- * 1. filter(expr)-->XXX out join.
- * For example, for left join, the redundant expression for right side is not useful, because we cannot push expression
- * down to right child. Refer to PushDownJoinOtherCondition Rule for push-down cases.
- * But it is hard to detect this case, if the outer join is a descendant but not child of the filter.
- * 2. filter(expr)
- *       |-->upper-join
- *             |-->bottom-join
- *             +-->child
- * In current version, we do not extract redundant expression for bottom-join. This redundancy is good for
- * upper-join (reduce the number of input tuple from bottom join), but it becomes unuseful if we rotate the join tree.

Review Comment:
   It would be better to keep the comments that describes when this rule should not be applied



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