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/05/16 12:51:00 UTC

[GitHub] [incubator-doris] jackwener opened a new pull request, #9598: [feature](nereids): add join rules base code

jackwener opened a new pull request, #9598:
URL: https://github.com/apache/incubator-doris/pull/9598

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (No)
   2. Has unit tests been added: (No Need)
   3. Has document been added or modified: (No Need)
   4. Does it need to update dependencies: (No)
   5. Are there any changes that cannot be rolled back: (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] [incubator-doris] jackwener commented on a diff in pull request #9598: [feature](nereids): add join rules base code

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommutative.java:
##########
@@ -15,28 +15,43 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.doris.nereids.rules.exploration;
+package org.apache.doris.nereids.rules.exploration.join;
 
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
-import org.apache.doris.nereids.trees.plans.JoinType;
+import org.apache.doris.nereids.rules.exploration.OneExplorationRuleFactory;
 import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
 
 /**
  * rule factory for exchange inner join's children.
  */
 public class JoinCommutative extends OneExplorationRuleFactory {
+    private boolean justApplyInnerOuterCrossJoin = false;
+
+    private final SwapType swapType;
+
+    /**
+     * If param is true, just apply rule in inner/full-outer/cross join.
+     */
+    public JoinCommutative(boolean justApplyInnerOuterCrossJoin) {
+        this.justApplyInnerOuterCrossJoin = justApplyInnerOuterCrossJoin;
+        this.swapType = SwapType.ALL;

Review Comment:
   limit swap space, we should change `JoinReorderContext ` according to it 
   - left deep tree -> bottom join and disable l-asscom
   - zig-zag ...
   - busy...



-- 
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] [incubator-doris] yiguolei merged pull request #9598: [feature](nereids): add join rules base code

Posted by GitBox <gi...@apache.org>.
yiguolei merged PR #9598:
URL: https://github.com/apache/incubator-doris/pull/9598


-- 
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] [incubator-doris] jackwener commented on a diff in pull request #9598: [feature](nereids): add join rules base code

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommutative.java:
##########
@@ -15,28 +15,43 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.doris.nereids.rules.exploration;
+package org.apache.doris.nereids.rules.exploration.join;
 
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
-import org.apache.doris.nereids.trees.plans.JoinType;
+import org.apache.doris.nereids.rules.exploration.OneExplorationRuleFactory;
 import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
 
 /**
  * rule factory for exchange inner join's children.
  */
 public class JoinCommutative extends OneExplorationRuleFactory {

Review Comment:
   The current code is just an example. 
   Can't run.



-- 
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] [incubator-doris] github-actions[bot] commented on pull request #9598: [feature](nereids): add join rules base code

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #9598:
URL: https://github.com/apache/incubator-doris/pull/9598#issuecomment-1131840318

   PR approved by at least one committer and no changes requested.


-- 
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] [incubator-doris] jackwener commented on a diff in pull request #9598: [feature](nereids): add join rules base code

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommutative.java:
##########
@@ -15,28 +15,43 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.doris.nereids.rules.exploration;
+package org.apache.doris.nereids.rules.exploration.join;
 
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
-import org.apache.doris.nereids.trees.plans.JoinType;
+import org.apache.doris.nereids.rules.exploration.OneExplorationRuleFactory;
 import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
 
 /**
  * rule factory for exchange inner join's children.
  */
 public class JoinCommutative extends OneExplorationRuleFactory {
+    private boolean justApplyInnerOuterCrossJoin = false;
+
+    private final SwapType swapType;
+
+    /**
+     * If param is true, just apply rule in inner/full-outer/cross join.
+     */
+    public JoinCommutative(boolean justApplyInnerOuterCrossJoin) {
+        this.justApplyInnerOuterCrossJoin = justApplyInnerOuterCrossJoin;
+        this.swapType = SwapType.ALL;

Review Comment:
   limit swap space, we should change `JoinReorderContext ` according to it 
   - left deep tree -> swap bottom join and disable l-asscom
   - zig-zag ...
   - busy...



-- 
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] [incubator-doris] EmmyMiao87 commented on a diff in pull request #9598: [feature](nereids): add join rules base code

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on code in PR #9598:
URL: https://github.com/apache/incubator-doris/pull/9598#discussion_r874531016


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommutative.java:
##########
@@ -15,28 +15,43 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.doris.nereids.rules.exploration;
+package org.apache.doris.nereids.rules.exploration.join;
 
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
-import org.apache.doris.nereids.trees.plans.JoinType;
+import org.apache.doris.nereids.rules.exploration.OneExplorationRuleFactory;
 import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
 
 /**
  * rule factory for exchange inner join's children.
  */
 public class JoinCommutative extends OneExplorationRuleFactory {
+    private boolean justApplyInnerOuterCrossJoin = false;
+
+    private final SwapType swapType;
+
+    /**
+     * If param is true, just apply rule in inner/full-outer/cross join.
+     */
+    public JoinCommutative(boolean justApplyInnerOuterCrossJoin) {
+        this.justApplyInnerOuterCrossJoin = justApplyInnerOuterCrossJoin;
+        this.swapType = SwapType.ALL;

Review Comment:
   What's this used for ?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinExchange.java:
##########
@@ -0,0 +1,57 @@
+// 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.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.rules.exploration.OneExplorationRuleFactory;
+import org.apache.doris.nereids.trees.plans.Plan;
+import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
+
+
+/**
+ * For busy-tree, exchange the children node.
+ */
+public class JoinExchange extends OneExplorationRuleFactory {
+    /*
+     *        topJoin                      newTopJoin
+     *        /      \                      /      \
+     *   leftJoin  rightJoin   -->   newLeftJoin newRightJoin
+     *    /    \    /    \            /    \        /    \
+     *   A      B  C      D          A      C      B      D
+     */
+    @Override
+    public Rule<Plan> build() {
+        return innerLogicalJoin(innerLogicalJoin(), any()).then(topJoin -> {

Review Comment:
   Is it correct?
   Maybe it should be ```innerLogicalJoin(innerLogicalJoin(), innerLogicalJoin()) ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommutative.java:
##########
@@ -15,28 +15,43 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.doris.nereids.rules.exploration;
+package org.apache.doris.nereids.rules.exploration.join;
 
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
-import org.apache.doris.nereids.trees.plans.JoinType;
+import org.apache.doris.nereids.rules.exploration.OneExplorationRuleFactory;
 import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
 
 /**
  * rule factory for exchange inner join's children.
  */
 public class JoinCommutative extends OneExplorationRuleFactory {

Review Comment:
   Could you please add some unit test for those rule ?



-- 
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] [incubator-doris] github-actions[bot] commented on pull request #9598: [feature](nereids): add join rules base code

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #9598:
URL: https://github.com/apache/incubator-doris/pull/9598#issuecomment-1131840377

   PR approved by anyone and no changes requested.


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