This is an automated email from the ASF dual-hosted git repository.

jakevin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 26d642d5e93 [enhancement](Nereids) format some code in functional deps 
(#27797)
26d642d5e93 is described below

commit 26d642d5e93e890c732720c6aa3805358fcc8aa7
Author: 谢健 <[email protected]>
AuthorDate: Tue Dec 5 11:45:03 2023 +0800

    [enhancement](Nereids) format some code in functional deps (#27797)
---
 .../nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java     | 5 +++--
 .../org/apache/doris/nereids/properties/FunctionalDependencies.java  | 4 ++--
 .../doris/nereids/trees/plans/logical/LogicalCatalogRelation.java    | 5 +++--
 .../apache/doris/nereids/trees/plans/logical/LogicalCheckPolicy.java | 4 ++--
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java
index 2eb386ce21c..c1a830faa9e 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java
@@ -49,6 +49,7 @@ import org.apache.doris.nereids.util.JoinUtils;
 import org.apache.doris.nereids.util.PlanUtils;
 import org.apache.doris.qe.ConnectContext;
 
+import cfjd.com.google.common.collect.ImmutableList;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 
@@ -380,8 +381,8 @@ public class PlanReceiver implements AbstractReceiver {
         if (!outputSet.equals(new HashSet<>(projects))) {
             LogicalProperties projectProperties = new LogicalProperties(
                     () -> projects.stream()
-                            .map(p -> p.toSlot())
-                            .collect(Collectors.toList()), () -> 
FunctionalDependencies.EMPTY_FUNC_DEPS);
+                            .map(NamedExpression::toSlot)
+                            .collect(ImmutableList.toImmutableList()), () -> 
FunctionalDependencies.EMPTY_FUNC_DEPS);
             allChild = allChild.stream()
                     .map(c -> new PhysicalProject<>(projects, 
projectProperties, c))
                     .collect(Collectors.toList());
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/FunctionalDependencies.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/FunctionalDependencies.java
index 73a78b0da25..c2ba22b5dc8 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/FunctionalDependencies.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/FunctionalDependencies.java
@@ -32,6 +32,7 @@ import java.util.stream.Collectors;
  * 2. uniform slotL it means the column that has ndv = 1, can be null
  */
 public class FunctionalDependencies {
+
     public static final FunctionalDependencies EMPTY_FUNC_DEPS
             = new FunctionalDependencies(new NestedSet().toImmutable(), new 
NestedSet().toImmutable());
     private final NestedSet uniqueSet;
@@ -81,8 +82,7 @@ public class FunctionalDependencies {
 
     @Override
     public String toString() {
-        return "uniform:" + uniformSet
-                + "\t unique:" + uniqueSet;
+        return String.format("FuncDeps[uniform:%s,  unique:%s]", uniformSet, 
uniqueSet);
     }
 
     /**
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalCatalogRelation.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalCatalogRelation.java
index a2c2c68ddc5..ed1e6a588be 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalCatalogRelation.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalCatalogRelation.java
@@ -125,8 +125,9 @@ public abstract class LogicalCatalogRelation extends 
LogicalRelation implements
         if (table instanceof OlapTable && ((OlapTable) 
table).getKeysType().isAggregationFamily()) {
             ImmutableSet<Slot> slotSet = computeOutput().stream()
                     .filter(SlotReference.class::isInstance)
-                    .filter(s -> ((SlotReference) s).getColumn().isPresent()
-                            && ((SlotReference) s).getColumn().get().isKey())
+                    .map(SlotReference.class::cast)
+                    .filter(s -> s.getColumn().isPresent()
+                            && s.getColumn().get().isKey())
                     .collect(ImmutableSet.toImmutableSet());
             fdBuilder.addUniqueSlot(slotSet);
         }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalCheckPolicy.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalCheckPolicy.java
index 12250bb7d76..5630153c0ce 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalCheckPolicy.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalCheckPolicy.java
@@ -47,8 +47,8 @@ import java.util.Optional;
 /**
  * Logical Check Policy
  */
-public class LogicalCheckPolicy<CHILD_TYPE extends Plan> extends 
LogicalUnary<CHILD_TYPE> implements
-        PropagateFuncDeps {
+public class LogicalCheckPolicy<CHILD_TYPE extends Plan> extends 
LogicalUnary<CHILD_TYPE>
+        implements PropagateFuncDeps {
 
     public LogicalCheckPolicy(CHILD_TYPE child) {
         super(PlanType.LOGICAL_CHECK_POLICY, child);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to