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/24 09:29:20 UTC

[GitHub] [doris] wangshuo128 opened a new pull request, #13601: [Feature](Nereids) Support join hint.

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

   # Proposed changes
   
   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] jackwener commented on a diff in pull request #13601: [Feature](Nereids) Support join hint.

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -851,10 +855,23 @@ private LogicalPlan withJoinRelations(LogicalPlan input, RelationContext ctx) {
                 condition = Optional.ofNullable(getExpression(joinCriteria.booleanExpression()));
             }
 
+            JoinHint joinHint = Optional.ofNullable(join.joinHint()).map(hintCtx -> {
+                String hint = typedVisit(join.joinHint());
+                if (JoinHint.JoinHintType.SHUFFLE.toString().equalsIgnoreCase(hint)) {
+                    return JoinHint.SHUFFLE_RIGHT;
+                } else if (JoinHint.JoinHintType.BROADCAST.toString().equalsIgnoreCase(hint)) {
+                    return JoinHint.BROADCAST_RIGHT;
+                } else {
+                    throw new ParseException("Invalid join hint: " + hint, hintCtx);
+                }

Review Comment:
   we can add them into a function like `public static JoinHint of(String name)`



-- 
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] morrySnow merged pull request #13601: [Feature](Nereids) Support join hint.

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


-- 
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 #13601: [Feature](Nereids) Support join hint.

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

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 34.4 seconds
    load time: 441 seconds
    storage size: 17148662222 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221115113631_clickbench_pr_46389.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] wangshuo128 commented on a diff in pull request #13601: [Feature](Nereids) Support join hint.

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/RequestPropertyDeriver.java:
##########
@@ -128,25 +129,45 @@ public Void visitPhysicalLocalQuickSort(PhysicalLocalQuickSort<? extends Plan> s
 
     @Override
     public Void visitPhysicalHashJoin(PhysicalHashJoin<? extends Plan, ? extends Plan> hashJoin, PlanContext context) {
-        // for broadcast join
-        if (JoinUtils.couldBroadcast(hashJoin)) {
-            addToRequestPropertyToChildren(PhysicalProperties.ANY, PhysicalProperties.REPLICATED);
-        }
+        JoinHint hint = hashJoin.getHint();

Review Comment:
   Please help to check the change here, thanks~ @morrySnow 



-- 
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] morrySnow commented on a diff in pull request #13601: [Feature](Nereids) Support join hint.

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/ReorderJoin.java:
##########
@@ -90,6 +91,11 @@ public Plan joinToMultiJoin(Plan plan) {
             return plan;
         }
 
+        // Can't reorder the join inputs if this join has hints.
+        if (plan instanceof LogicalJoin && ((LogicalJoin) plan).hasJoinHint()) {
+            return plan;
+        }
+

Review Comment:
   could we still eliminate all cross join if we add this?



##########
fe/fe-core/src/test/java/org/apache/doris/nereids/util/ExceptionChecker.java:
##########
@@ -37,6 +37,7 @@ public ExceptionChecker assertMessageEquals(String message) {
     }
 
     public ExceptionChecker assertMessageContains(String context) {
+        System.out.println(exception.getMessage());
         Assertions.assertTrue(exception.getMessage().contains(context));

Review Comment:
   Assertions.assertTrue(exception.getMessage().contains(context), exception.getMessage());



##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -122,7 +122,13 @@ relation
     ;
 
 joinRelation
-    : (joinType) JOIN right=relationPrimary joinCriteria?
+     : (joinType) JOIN joinHint? right=relationPrimary joinCriteria?
+     ;

Review Comment:
   ```suggestion
       : (joinType) JOIN joinHint? right=relationPrimary joinCriteria?
       ;
   ```



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