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/08/27 14:03:39 UTC

[GitHub] [doris] jackwener opened a new pull request, #12127: [fix](Nereids): enhance equals UT

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

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   - enhance the equals UT
   - add EqualTo of
   - minor
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [x] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [x] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [x] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [x] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [x] 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] morrySnow merged pull request #12127: [improve](Nereids): enhance equals UT

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


-- 
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] adonis0147 commented on a diff in pull request #12127: [fix](Nereids): enhance equals UT

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/EqualTo.java:
##########
@@ -33,6 +33,10 @@ public EqualTo(Expression left, Expression right) {
         super(left, right, "=");
     }
 
+    public static EqualTo of(Expression left, Expression right) {

Review Comment:
   I think it is not evil to use `new` to instantiate an object. JVM may not always inline some methods. An extra wrapper method which just passes argument to `new` only may introduce some unnecessary costs.



-- 
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] github-actions[bot] commented on pull request #12127: [improve](Nereids): enhance equals UT

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

   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] [doris] jackwener commented on a diff in pull request #12127: [fix](Nereids): enhance equals UT

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/EqualTo.java:
##########
@@ -33,6 +33,10 @@ public EqualTo(Expression left, Expression right) {
         super(left, right, "=");
     }
 
+    public static EqualTo of(Expression left, Expression right) {

Review Comment:
   Like ImmutableList.of()
   we don,t need new



-- 
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] adonis0147 commented on a diff in pull request #12127: [fix](Nereids): enhance equals UT

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/EqualTo.java:
##########
@@ -33,6 +33,10 @@ public EqualTo(Expression left, Expression right) {
         super(left, right, "=");
     }
 
+    public static EqualTo of(Expression left, Expression right) {

Review Comment:
   I think it is not evil to use `new` to instantiate an object. JVM may not always inline some methods. An extra wrapper method which just passes argument to `new` only may introduce some costs.



-- 
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] github-actions[bot] commented on pull request #12127: [improve](Nereids): enhance equals UT

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

   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


[GitHub] [doris] adonis0147 commented on a diff in pull request #12127: [fix](Nereids): enhance equals UT

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/EqualTo.java:
##########
@@ -33,6 +33,10 @@ public EqualTo(Expression left, Expression right) {
         super(left, right, "=");
     }
 
+    public static EqualTo of(Expression left, Expression right) {

Review Comment:
   I think it is not evil to use `new` to instantiate an object. JVM may not always inline some methods. An extra wrapper method which just passes arguments to `new` only may introduce some unnecessary costs.



-- 
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 #12127: [fix](Nereids): enhance equals UT

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


##########
fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java:
##########
@@ -48,193 +49,259 @@
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 
-// TODO: need more detailed test
 public class PlanEqualsTest {
     /* *************************** Logical *************************** */
     @Test
     public void testLogicalAggregate(@Mocked Plan child) {
-        List<Expression> groupByExprList = Lists.newArrayList();
         List<NamedExpression> outputExpressionList = ImmutableList.of(
-                new SlotReference("a", new BigIntType(), true, Lists.newArrayList())
-        );
-
-        LogicalAggregate one = new LogicalAggregate(groupByExprList, outputExpressionList, child);
-        Assertions.assertEquals(one, one);
+                new SlotReference(new ExprId(0), "a", new BigIntType(), true, Lists.newArrayList()));
+        LogicalAggregate<Plan> logicalAggregate = new LogicalAggregate<>(Lists.newArrayList(), outputExpressionList,

Review Comment:
   we could use `actual`, `expected` and `unexpected` as their names



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalJoin.java:
##########
@@ -89,13 +88,15 @@ public boolean equals(Object o) {
         if (o == null || getClass() != o.getClass()) {
             return false;
         }
-        AbstractPhysicalJoin that = (AbstractPhysicalJoin) o;
-        return joinType == that.joinType && Objects.equals(otherJoinCondition, that.otherJoinCondition);
+        AbstractPhysicalJoin<?, ?> that = (AbstractPhysicalJoin<?, ?>) o;
+        return joinType == that.joinType && hashJoinConjuncts.equals(that.hashJoinConjuncts)
+                && otherJoinCondition.equals(
+                that.otherJoinCondition);

Review Comment:
   ```suggestion
                   && otherJoinCondition.equals(that.otherJoinCondition);
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/memo/GroupExpression.java:
##########
@@ -69,10 +69,9 @@ public GroupExpression(Plan plan, List<Group> children) {
         this.requestPropertiesMap = Maps.newHashMap();
     }
 
-    // TODO: rename
-    public PhysicalProperties getPropertyFromMap(PhysicalProperties requiredPropertySet) {
-        PhysicalProperties outputProperty = requestPropertiesMap.get(requiredPropertySet);
-        Preconditions.checkState(outputProperty != null);
+    public PhysicalProperties getOutputProperty(PhysicalProperties requestProperty) {
+        PhysicalProperties outputProperty = requestPropertiesMap.get(requestProperty);

Review Comment:
   we'd better to use plural uniformly, e.g. properties



-- 
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] adonis0147 commented on a diff in pull request #12127: [fix](Nereids): enhance equals UT

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/EqualTo.java:
##########
@@ -33,6 +33,10 @@ public EqualTo(Expression left, Expression right) {
         super(left, right, "=");
     }
 
+    public static EqualTo of(Expression left, Expression right) {

Review Comment:
   What's the benefit of introducing the static method `EqualTo::of`?



-- 
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] adonis0147 commented on a diff in pull request #12127: [fix](Nereids): enhance equals UT

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/EqualTo.java:
##########
@@ -33,6 +33,10 @@ public EqualTo(Expression left, Expression right) {
         super(left, right, "=");
     }
 
+    public static EqualTo of(Expression left, Expression right) {

Review Comment:
   I think it is not evil to use `new` to instantiate an object. JVM may not always inline some methods. An extra wrapper method which just passes arguments to `new` only may introduce some unnecessary costs.
   
   Besides, unlike `list of` (a list of sth), `equalto of` looks weird.



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