You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/10/28 06:11:29 UTC

[GitHub] [doris] englefly opened a new pull request, #13756: [feature](nereids) add rule for semi/anti join exploration, when there is project between them

englefly opened a new pull request, #13756:
URL: https://github.com/apache/doris/pull/13756

   # Proposed changes
   
    ```
          /*
            *     t1.name=t3.name               t1.id=t2.id
            *       topJoin                  newTopJoin
            *       /     \                   /     \
            *    project   t3           project     t2
            *    t1.name            t1.name, t1.id
            *      |                       |
            * t1.id=t2.id            t1.name=t3.name
            * bottomJoin       -->   newBottomJoin
            *   /    \                   /    \
            * t1      t2               t1      t3
            */
   ```
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


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


[GitHub] [doris] hello-stephen commented on pull request #13756: [feature](nereids) add rule for semi/anti join exploration, when there is project between them

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #13756:
URL: https://github.com/apache/doris/pull/13756#issuecomment-1294537498

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 38.87 seconds
    load time: 562 seconds
    storage size: 17154644839 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221028064837_clickbench_pr_35197.html


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


[GitHub] [doris] hello-stephen commented on pull request #13756: [feature](nereids) add rule for semi/anti join exploration, when there is project between them

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #13756:
URL: https://github.com/apache/doris/pull/13756#issuecomment-1294672554

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 38.55 seconds
    load time: 572 seconds
    storage size: 17154662403 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221028081844_clickbench_pr_35226.html


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


[GitHub] [doris] jackwener merged pull request #13756: [feature](nereids) add rule for semi/anti join exploration, when there is project between them

Posted by GitBox <gi...@apache.org>.
jackwener merged PR #13756:
URL: https://github.com/apache/doris/pull/13756


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


[GitHub] [doris] jackwener commented on a diff in pull request #13756: [feature](nereids) add rule for semi/anti join exploration, when there is project between them

Posted by GitBox <gi...@apache.org>.
jackwener commented on code in PR #13756:
URL: https://github.com/apache/doris/pull/13756#discussion_r1009336239


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProject.java:
##########
@@ -0,0 +1,99 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.rules.exploration.join;
+
+import org.apache.doris.common.Pair;
+import org.apache.doris.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.rules.exploration.OneExplorationRuleFactory;
+import org.apache.doris.nereids.trees.expressions.NamedExpression;
+import org.apache.doris.nereids.trees.expressions.Slot;
+import org.apache.doris.nereids.trees.plans.GroupPlan;
+import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
+import org.apache.doris.nereids.trees.plans.logical.LogicalProject;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * rule for semi-semi transpose
+ */
+public class SemiJoinSemiJoinTransposeProject extends OneExplorationRuleFactory {
+    public static final SemiJoinSemiJoinTransposeProject INSTANCE = new SemiJoinSemiJoinTransposeProject();
+
+    /*
+     *        topSemi                   newTopSemi
+     *        /     \                   /        \
+     *    abProject  C               acProject    B
+     *      /            ──►          /
+     * bottomSemi                newBottomSemi
+     *    /   \                     /   \
+     *   A     B                   A     C
+     */
+    @Override
+    public Rule build() {
+        return logicalJoin(logicalProject(logicalJoin()), group())
+                .when(this::typeChecker)
+                .when(topSemi -> InnerJoinLAsscom.checkReorder(topSemi, topSemi.left().child()))
+                .then(topSemi -> {
+                    LogicalJoin<GroupPlan, GroupPlan> bottomSemi = topSemi.left().child();
+                    LogicalProject abProject = topSemi.left();
+                    GroupPlan a = bottomSemi.left();
+                    GroupPlan b = bottomSemi.right();
+                    GroupPlan c = topSemi.right();
+                    Set<Slot> aOutputSet = a.getOutputSet();
+                    Set<NamedExpression> acProjects = new HashSet<NamedExpression>(abProject.getProjects());
+
+                    bottomSemi.getHashJoinConjuncts().stream().forEach(
+                            expression -> {
+                                expression.getInputSlots().stream().forEach(
+                                        slot -> {
+                                            if (aOutputSet.contains(slot)) {
+                                                acProjects.add(slot);
+                                            }
+                                        });
+                            }
+                    );
+                    LogicalJoin newBottomSemi = new LogicalJoin(topSemi.getJoinType(), topSemi.getHashJoinConjuncts(),
+                            topSemi.getOtherJoinConjuncts(), a, c,
+                            bottomSemi.getJoinReorderContext());
+                    newBottomSemi.getJoinReorderContext().setHasCommute(false);
+                    newBottomSemi.getJoinReorderContext().setHasLAsscom(false);

Review Comment:
   mask check don't need set.



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