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/07/28 04:15:29 UTC

[GitHub] [doris] 924060929 commented on a diff in pull request #11222: [feature](nereids): polish property deriver enforcer job

924060929 commented on code in PR #11222:
URL: https://github.com/apache/doris/pull/11222#discussion_r930806836


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/DistributionSpecAny.java:
##########
@@ -18,8 +18,16 @@
 package org.apache.doris.nereids.properties;
 
 /**
- * Describe random distribution.
+ * Data can be anywhere on the segments (required only).
  */
-public class RandomDistributionDesc extends DistributionSpec {
+public class DistributionSpecAny extends DistributionSpec {
 
+    public DistributionSpecAny() {

Review Comment:
   I think AnyDistribution can use singleton, and maybe XxxDistribution is more readable?
   e.g. HashDistribution, AnyDistribution, RandomDistribution



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/DistributionSpecAny.java:
##########
@@ -18,8 +18,16 @@
 package org.apache.doris.nereids.properties;
 
 /**
- * Describe random distribution.
+ * Data can be anywhere on the segments (required only).
  */
-public class RandomDistributionDesc extends DistributionSpec {
+public class DistributionSpecAny extends DistributionSpec {
 
+    public DistributionSpecAny() {
+        super();
+    }
+
+    @Override
+    public boolean meet(DistributionSpec other) {

Review Comment:
   ```suggestion
       public boolean satisfy(DistributionSpec other) {
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java:
##########
@@ -0,0 +1,124 @@
+// 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.util;
+
+import org.apache.doris.common.Pair;
+import org.apache.doris.nereids.trees.expressions.EqualTo;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.SlotReference;
+import org.apache.doris.nereids.trees.plans.Plan;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalHashJoin;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Utils for join
+ */
+public class JoinUtils {
+    public static boolean onlyBroadcast(PhysicalHashJoin join) {
+        // Cross-join only can be broadcast join.
+        return join.getJoinType().isCrossJoin();
+    }
+
+    public static boolean onlyShuffle(PhysicalHashJoin join) {
+        return join.getJoinType().isRightJoin() || join.getJoinType().isFullOuterJoin();
+    }
+
+    /**
+     * Get all equalTo from onClause of join
+     */
+    public static List<EqualTo> getEqualTo(PhysicalHashJoin<Plan, Plan> join) {
+        List<SlotReference> leftSlots = join.left().getOutput().stream().map(slot -> (SlotReference) slot)
+                .collect(Collectors.toList());
+        List<SlotReference> rightSlots = join.right().getOutput().stream().map(slot -> (SlotReference) slot)
+                .collect(Collectors.toList());
+
+        List<EqualTo> eqConjuncts = Lists.newArrayList();
+
+
+        if (!join.getCondition().isPresent()) {

Review Comment:
   you can move this condition to the start of this function



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