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

morrysnow 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 2398cd3bb6 [enhancement](Nereids)print slot name in explain string 
(#12272)
2398cd3bb6 is described below

commit 2398cd3bb6e17d2bf28088a3fb106acfbc5b8920
Author: morrySnow <[email protected]>
AuthorDate: Mon Sep 5 11:31:35 2022 +0800

    [enhancement](Nereids)print slot name in explain string (#12272)
    
    Currently, explain string print all expression as slot id, e.g. `<slot 1>`.
    This PR, print its name with slot id instead, e.g. `column_a[#1]`. For 
details:
    - print qualified table name for OlapScanNode
    - print NamedExpression name with SlotId instead of just SlotId
    - OlapScanNode's node name use "OlapScanNode" instead of table name
---
 .../java/org/apache/doris/analysis/SlotRef.java    | 11 +++++--
 .../java/org/apache/doris/catalog/Database.java    |  8 +++++
 .../org/apache/doris/catalog/PartitionInfo.java    |  1 +
 .../main/java/org/apache/doris/catalog/Table.java  | 14 +++++++++
 .../glue/translator/PhysicalPlanTranslator.java    |  4 +--
 .../glue/translator/PlanTranslatorContext.java     |  4 ++-
 .../trees/plans/logical/LogicalOlapScan.java       |  2 +-
 .../trees/plans/logical/LogicalRelation.java       | 12 ++++----
 .../trees/plans/physical/PhysicalOlapScan.java     | 35 +++++++++++-----------
 .../trees/plans/physical/PhysicalRelation.java     |  4 +--
 .../org/apache/doris/planner/OlapScanNode.java     |  3 +-
 .../translator/PhysicalPlanTranslatorTest.java     | 11 ++++---
 .../doris/nereids/jobs/RewriteTopDownJobTest.java  |  4 +--
 .../rewrite/logical/AggregateDisassembleTest.java  |  2 +-
 .../logical/FindHashConditionForJoinTest.java      |  4 +--
 .../rewrite/logical/NormalizeAggregateTest.java    |  2 +-
 .../rewrite/logical/PushDownPredicateTest.java     |  6 ++--
 .../PushDownPredicateThroughAggregationTest.java   |  4 +--
 .../doris/nereids/stats/StatsCalculatorTest.java   |  4 +--
 .../doris/nereids/trees/plans/PlanEqualsTest.java  |  6 ++--
 .../doris/nereids/trees/plans/PlanOutputTest.java  |  2 +-
 .../nereids/trees/plans/PlanToStringTest.java      |  2 +-
 .../apache/doris/nereids/util/PlanConstructor.java | 19 ++++++------
 23 files changed, 97 insertions(+), 67 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java
index 0bd5470ed0..921670fbb2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java
@@ -26,6 +26,7 @@ import org.apache.doris.catalog.Type;
 import org.apache.doris.common.AnalysisException;
 import org.apache.doris.common.io.Text;
 import org.apache.doris.common.util.ToSqlContext;
+import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.thrift.TExprNode;
 import org.apache.doris.thrift.TExprNodeType;
 import org.apache.doris.thrift.TSlotRef;
@@ -205,9 +206,15 @@ public class SlotRef extends Expr {
         StringBuilder sb = new StringBuilder();
 
         if (tblName != null) {
-            return tblName.toSql() + "." + label + sb.toString();
+            return tblName.toSql() + "." + label;
         } else if (label != null) {
-            return label + sb.toString();
+            if (ConnectContext.get() != null
+                    && ConnectContext.get().getSessionVariable() != null
+                    && 
ConnectContext.get().getSessionVariable().isEnableNereidsPlanner()) {
+                return label + "[#" + desc.getId().asInt() + "]";
+            } else {
+                return label;
+            }
         } else if (desc.getSourceExprs() != null) {
             if (ToSqlContext.get() == null || 
ToSqlContext.get().isNeedSlotRefId()) {
                 if (desc.getId().asInt() != 1) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
index b01a020f4a..0229551cc7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
@@ -193,6 +193,9 @@ public class Database extends MetaObject implements 
Writable, DatabaseIf<Table>
         writeLock();
         try {
             this.fullQualifiedName = newName;
+            for (Table table : idToTable.values()) {
+                table.setQualifiedDbName(fullQualifiedName);
+            }
         } finally {
             writeUnlock();
         }
@@ -361,6 +364,7 @@ public class Database extends MetaObject implements 
Writable, DatabaseIf<Table>
 
     public boolean createTable(Table table) {
         boolean result = true;
+        table.setQualifiedDbName(fullQualifiedName);
         String tableName = table.getName();
         if (Env.isStoredTableNamesLowerCase()) {
             tableName = tableName.toLowerCase();
@@ -564,6 +568,7 @@ public class Database extends MetaObject implements 
Writable, DatabaseIf<Table>
         int numTables = in.readInt();
         for (int i = 0; i < numTables; ++i) {
             Table table = Table.read(in);
+            table.setQualifiedDbName(fullQualifiedName);
             String tableName = table.getName();
             nameToTable.put(tableName, table);
             idToTable.put(table.getId(), table);
@@ -651,6 +656,9 @@ public class Database extends MetaObject implements 
Writable, DatabaseIf<Table>
 
     public void setName(String name) {
         this.fullQualifiedName = name;
+        for (Table table : nameToTable.values()) {
+            table.setQualifiedDbName(name);
+        }
     }
 
     public synchronized void addFunction(Function function) throws 
UserException {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionInfo.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionInfo.java
index c97fcccaa7..a18c5308c1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionInfo.java
@@ -71,6 +71,7 @@ public class PartitionInfo implements Writable {
     protected Map<Long, TTabletType> idToTabletType;
 
     public PartitionInfo() {
+        this.type = PartitionType.UNPARTITIONED;
         this.idToDataProperty = new HashMap<>();
         this.idToReplicaAllocation = new HashMap<>();
         this.idToInMemory = new HashMap<>();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
index 5602fa9389..e46080e4c9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
@@ -33,6 +33,7 @@ import com.google.common.base.Strings;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import org.apache.commons.lang.NotImplementedException;
+import org.apache.commons.lang.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
@@ -60,6 +61,7 @@ public abstract class Table extends MetaObject implements 
Writable, TableIf {
 
     protected long id;
     protected volatile String name;
+    protected volatile String qualifiedDbName;
     protected TableType type;
     protected long createTime;
     protected ReentrantReadWriteLock rwLock;
@@ -248,6 +250,18 @@ public abstract class Table extends MetaObject implements 
Writable, TableIf {
         name = newName;
     }
 
+    void setQualifiedDbName(String qualifiedDbName) {
+        this.qualifiedDbName = qualifiedDbName;
+    }
+
+    public String getQualifiedName() {
+        if (StringUtils.isEmpty(qualifiedDbName)) {
+            return name;
+        } else {
+            return qualifiedDbName + "." + name;
+        }
+    }
+
     public TableType getType() {
         return type;
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
index 9f2270eb35..50632182ae 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
@@ -217,13 +217,13 @@ public class PhysicalPlanTranslator extends 
DefaultPlanVisitor<PlanFragment, Pla
         OlapTable olapTable = olapScan.getTable();
         TupleDescriptor tupleDescriptor = generateTupleDesc(slotList, 
olapTable, context);
         tupleDescriptor.setTable(olapTable);
-        OlapScanNode olapScanNode = new OlapScanNode(context.nextPlanNodeId(), 
tupleDescriptor, olapTable.getName());
+        OlapScanNode olapScanNode = new OlapScanNode(context.nextPlanNodeId(), 
tupleDescriptor, "OlapScanNode");
         // TODO: Do we really need tableName here?
         TableName tableName = new TableName(null, "", "");
         TableRef ref = new TableRef(tableName, null, null);
         BaseTableRef tableRef = new BaseTableRef(ref, olapTable, tableName);
         tupleDescriptor.setRef(tableRef);
-        
olapScanNode.setSelectedPartitionIds(olapScan.getSelectedPartitionId());
+        
olapScanNode.setSelectedPartitionIds(olapScan.getSelectedPartitionIds());
         try {
             
olapScanNode.updateScanRangeInfoByNewMVSelector(olapScan.getSelectedIndexId(), 
false, "");
         } catch (Exception e) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java
index c412bedabe..9634977653 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java
@@ -121,7 +121,9 @@ public class PlanTranslatorContext {
         }
         
slotDescriptor.setType(slotReference.getDataType().toCatalogDataType());
         slotDescriptor.setIsMaterialized(true);
-        this.addExprIdSlotRefPair(slotReference.getExprId(), new 
SlotRef(slotDescriptor));
+        SlotRef slotRef = new SlotRef(slotDescriptor);
+        slotRef.setLabel(slotReference.getName());
+        this.addExprIdSlotRefPair(slotReference.getExprId(), slotRef);
         slotDescriptor.setIsNullable(slotReference.nullable());
         return slotDescriptor;
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java
index fc4e5d082f..5dfac9febb 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java
@@ -85,7 +85,7 @@ public class LogicalOlapScan extends LogicalRelation {
     @Override
     public String toString() {
         return Utils.toSqlString("LogicalOlapScan",
-                "qualifier", qualifiedName(),
+                "qualified", qualifiedName(),
                 "output", getOutput()
         );
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalRelation.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalRelation.java
index eee472ace7..bab2f62ca8 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalRelation.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalRelation.java
@@ -29,7 +29,6 @@ import 
org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
 import org.apache.doris.nereids.util.Utils;
 
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
 
 import java.util.Collections;
 import java.util.List;
@@ -43,8 +42,7 @@ public abstract class LogicalRelation extends LogicalLeaf 
implements Scan {
 
     protected final Table table;
     protected final List<String> qualifier;
-
-    protected List<Long> selectedPartitionIds = Lists.newArrayList();
+    protected final List<Long> selectedPartitionIds;
 
     public LogicalRelation(PlanType type, Table table, List<String> qualifier) 
{
         this(type, table, qualifier, Optional.empty(), Optional.empty(), 
Collections.emptyList());
@@ -57,13 +55,13 @@ public abstract class LogicalRelation extends LogicalLeaf 
implements Scan {
      * @param qualifier qualified relation name
      */
     public LogicalRelation(PlanType type, Table table, List<String> qualifier,
-            Optional<GroupExpression> groupExpression,
-            Optional<LogicalProperties> logicalProperties,
-            List<Long> selectedPartitionIdList) {
+            Optional<GroupExpression> groupExpression, 
Optional<LogicalProperties> logicalProperties,
+            List<Long> selectedPartitionIds) {
         super(type, groupExpression, logicalProperties);
         this.table = Objects.requireNonNull(table, "table can not be null");
         this.qualifier = 
ImmutableList.copyOf(Objects.requireNonNull(qualifier, "qualifier can not be 
null"));
-        this.selectedPartitionIds = selectedPartitionIdList;
+        this.selectedPartitionIds = ImmutableList.copyOf(
+                Objects.requireNonNull(selectedPartitionIds, 
"selectedPartitionIds can not be null"));
     }
 
     public Table getTable() {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java
index 5ae5adc343..61ee6a5e09 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java
@@ -37,8 +37,8 @@ public class PhysicalOlapScan extends PhysicalRelation {
     private final OlapTable olapTable;
     private final DistributionSpec distributionSpec;
     private final long selectedIndexId;
-    private final List<Long> selectedTabletId;
-    private final List<Long> selectedPartitionId;
+    private final List<Long> selectedTabletIds;
+    private final List<Long> selectedPartitionIds;
 
     /**
      * Constructor for PhysicalOlapScan.
@@ -47,14 +47,13 @@ public class PhysicalOlapScan extends PhysicalRelation {
      * @param qualifier qualifier of table name
      */
     public PhysicalOlapScan(OlapTable olapTable, List<String> qualifier, long 
selectedIndexId,
-            List<Long> selectedTabletId, List<Long> selectedPartitionId, 
DistributionSpec distributionSpec,
+            List<Long> selectedTabletIds, List<Long> selectedPartitionIds, 
DistributionSpec distributionSpec,
             Optional<GroupExpression> groupExpression, LogicalProperties 
logicalProperties) {
         super(PlanType.PHYSICAL_OLAP_SCAN, qualifier, groupExpression, 
logicalProperties);
-
         this.olapTable = olapTable;
         this.selectedIndexId = selectedIndexId;
-        this.selectedTabletId = selectedTabletId;
-        this.selectedPartitionId = selectedPartitionId;
+        this.selectedTabletIds = selectedTabletIds;
+        this.selectedPartitionIds = selectedPartitionIds;
         this.distributionSpec = distributionSpec;
     }
 
@@ -62,12 +61,12 @@ public class PhysicalOlapScan extends PhysicalRelation {
         return selectedIndexId;
     }
 
-    public List<Long> getSelectedTabletId() {
-        return selectedTabletId;
+    public List<Long> getSelectedTabletIds() {
+        return selectedTabletIds;
     }
 
-    public List<Long> getSelectedPartitionId() {
-        return selectedPartitionId;
+    public List<Long> getSelectedPartitionIds() {
+        return selectedPartitionIds;
     }
 
     public OlapTable getTable() {
@@ -81,7 +80,7 @@ public class PhysicalOlapScan extends PhysicalRelation {
     @Override
     public String toString() {
         return Utils.toSqlString("PhysicalOlapScan",
-                "qualifier", Utils.qualifiedName(qualifier, 
olapTable.getName()),
+                "qualified", Utils.qualifiedName(qualifier, 
olapTable.getName()),
                 "output", getOutput()
         );
     }
@@ -96,14 +95,14 @@ public class PhysicalOlapScan extends PhysicalRelation {
         }
         PhysicalOlapScan that = (PhysicalOlapScan) o;
         return selectedIndexId == that.selectedIndexId
-                && Objects.equals(selectedTabletId, that.selectedTabletId)
-                && Objects.equals(selectedPartitionId, 
that.selectedPartitionId)
+                && Objects.equals(selectedTabletIds, that.selectedTabletIds)
+                && Objects.equals(selectedPartitionIds, 
that.selectedPartitionIds)
                 && Objects.equals(olapTable, that.olapTable);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(selectedIndexId, selectedPartitionId, 
selectedTabletId, olapTable);
+        return Objects.hash(selectedIndexId, selectedPartitionIds, 
selectedTabletIds, olapTable);
     }
 
     @Override
@@ -113,13 +112,13 @@ public class PhysicalOlapScan extends PhysicalRelation {
 
     @Override
     public Plan withGroupExpression(Optional<GroupExpression> groupExpression) 
{
-        return new PhysicalOlapScan(olapTable, qualifier, selectedIndexId, 
selectedTabletId, selectedPartitionId,
-                distributionSpec, groupExpression, logicalProperties);
+        return new PhysicalOlapScan(olapTable, qualifier, selectedIndexId, 
selectedTabletIds,
+                selectedPartitionIds, distributionSpec, groupExpression, 
logicalProperties);
     }
 
     @Override
     public Plan withLogicalProperties(Optional<LogicalProperties> 
logicalProperties) {
-        return new PhysicalOlapScan(olapTable, qualifier, selectedIndexId, 
selectedTabletId, selectedPartitionId,
-                distributionSpec, Optional.empty(), logicalProperties.get());
+        return new PhysicalOlapScan(olapTable, qualifier, selectedIndexId, 
selectedTabletIds,
+                selectedPartitionIds, distributionSpec, Optional.empty(), 
logicalProperties.get());
     }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalRelation.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalRelation.java
index 93898031c2..330801cd24 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalRelation.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalRelation.java
@@ -43,8 +43,8 @@ public abstract class PhysicalRelation extends PhysicalLeaf 
implements Scan {
      * @param type node type
      * @param qualifier table's name
      */
-    public PhysicalRelation(PlanType type, List<String> qualifier, 
Optional<GroupExpression> groupExpression,
-                            LogicalProperties logicalProperties) {
+    public PhysicalRelation(PlanType type, List<String> qualifier,
+            Optional<GroupExpression> groupExpression, LogicalProperties 
logicalProperties) {
         super(type, groupExpression, logicalProperties);
         this.qualifier = Objects.requireNonNull(qualifier, "qualifier can not 
be null");
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
index 3c82be05f6..2ee08fb24a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
@@ -816,7 +816,8 @@ public class OlapScanNode extends ScanNode {
         StringBuilder output = new StringBuilder();
 
         String indexName = olapTable.getIndexNameById(selectedIndexId);
-        output.append(prefix).append("TABLE: 
").append(olapTable.getName()).append("(").append(indexName).append(")");
+        output.append(prefix).append("TABLE: 
").append(olapTable.getQualifiedName())
+                .append("(").append(indexName).append(")");
         if (detailLevel == TExplainLevel.BRIEF) {
             return output.toString();
         }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslatorTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslatorTest.java
index 8762ce125b..29378e61c1 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslatorTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslatorTest.java
@@ -48,9 +48,8 @@ public class PhysicalPlanTranslatorTest {
 
     @Test
     public void testOlapPrune(@Mocked OlapTable t1, @Injectable 
LogicalProperties placeHolder) throws Exception {
-        List<String> qualifierList = new ArrayList<>();
-        qualifierList.add("test");
-        qualifierList.add("t1");
+        List<String> qualifier = new ArrayList<>();
+        qualifier.add("test");
         List<Slot> t1Output = new ArrayList<>();
         SlotReference col1 = new SlotReference("col1", IntegerType.INSTANCE);
         SlotReference col2 = new SlotReference("col2", IntegerType.INSTANCE);
@@ -59,17 +58,17 @@ public class PhysicalPlanTranslatorTest {
         t1Output.add(col2);
         t1Output.add(col3);
         LogicalProperties t1Properties = new LogicalProperties(() -> t1Output);
-        PhysicalOlapScan scan = new PhysicalOlapScan(t1, qualifierList, 0L,
+        PhysicalOlapScan scan = new PhysicalOlapScan(t1, qualifier, 0L,
                 Collections.emptyList(), Collections.emptyList(), null,
                 Optional.empty(),
                 t1Properties);
         Literal t1FilterRight = new IntegerLiteral(1);
         Expression t1FilterExpr = new GreaterThan(col1, t1FilterRight);
         PhysicalFilter<PhysicalOlapScan> filter =
-                new PhysicalFilter(t1FilterExpr, placeHolder, scan);
+                new PhysicalFilter<>(t1FilterExpr, placeHolder, scan);
         List<NamedExpression> projList = new ArrayList<>();
         projList.add(col2);
-        PhysicalProject<PhysicalFilter> project = new PhysicalProject(projList,
+        PhysicalProject<PhysicalFilter<PhysicalOlapScan>> project = new 
PhysicalProject<>(projList,
                 placeHolder, filter);
         PlanTranslatorContext planTranslatorContext = new 
PlanTranslatorContext();
         PhysicalPlanTranslator translator = new PhysicalPlanTranslator();
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/jobs/RewriteTopDownJobTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/jobs/RewriteTopDownJobTest.java
index 5d134de363..ad6f445a1b 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/jobs/RewriteTopDownJobTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/jobs/RewriteTopDownJobTest.java
@@ -109,8 +109,8 @@ public class RewriteTopDownJobTest {
 
         public LogicalBoundRelation(Table table, List<String> qualifier, 
Optional<GroupExpression> groupExpression,
                 Optional<LogicalProperties> logicalProperties) {
-            super(PlanType.LOGICAL_BOUND_RELATION, table, qualifier, 
groupExpression, logicalProperties,
-                    Collections.emptyList());
+            super(PlanType.LOGICAL_BOUND_RELATION, table, qualifier,
+                    groupExpression, logicalProperties, 
Collections.emptyList());
         }
 
         @Override
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/AggregateDisassembleTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/AggregateDisassembleTest.java
index 6d2dbc6d8a..d04eb4feb9 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/AggregateDisassembleTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/AggregateDisassembleTest.java
@@ -49,7 +49,7 @@ public class AggregateDisassembleTest {
 
     @BeforeAll
     public final void beforeAll() {
-        rStudent = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of("student"));
+        rStudent = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of(""));
     }
 
     /**
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/FindHashConditionForJoinTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/FindHashConditionForJoinTest.java
index 88fe1c71ab..5bd5a3d351 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/FindHashConditionForJoinTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/FindHashConditionForJoinTest.java
@@ -57,8 +57,8 @@ import java.util.Optional;
 class FindHashConditionForJoinTest {
     @Test
     public void testFindHashCondition() {
-        Plan student = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of("student"));
-        Plan score = new LogicalOlapScan(PlanConstructor.score, 
ImmutableList.of("score"));
+        Plan student = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of(""));
+        Plan score = new LogicalOlapScan(PlanConstructor.score, 
ImmutableList.of(""));
 
         Slot studentId = student.getOutput().get(0);
         Slot gender = student.getOutput().get(1);
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeAggregateTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeAggregateTest.java
index fd44a0d628..080151b246 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeAggregateTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeAggregateTest.java
@@ -48,7 +48,7 @@ public class NormalizeAggregateTest implements 
PatternMatchSupported {
 
     @BeforeAll
     public final void beforeAll() {
-        rStudent = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of("student"));
+        rStudent = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of(""));
     }
 
     /**
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushDownPredicateTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushDownPredicateTest.java
index bbb3bbc826..1f8e0b546a 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushDownPredicateTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushDownPredicateTest.java
@@ -69,11 +69,11 @@ public class PushDownPredicateTest {
      */
     @BeforeAll
     public final void beforeAll() {
-        rStudent = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of("student"));
+        rStudent = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of(""));
 
-        rScore = new LogicalOlapScan(PlanConstructor.score, 
ImmutableList.of("score"));
+        rScore = new LogicalOlapScan(PlanConstructor.score, 
ImmutableList.of(""));
 
-        rCourse = new LogicalOlapScan(PlanConstructor.course, 
ImmutableList.of("course"));
+        rCourse = new LogicalOlapScan(PlanConstructor.course, 
ImmutableList.of(""));
     }
 
     @Test
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushDownPredicateThroughAggregationTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushDownPredicateThroughAggregationTest.java
index fe762357b0..029caf6c4c 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushDownPredicateThroughAggregationTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushDownPredicateThroughAggregationTest.java
@@ -70,7 +70,7 @@ public class PushDownPredicateThroughAggregationTest {
     */
     @Test
     public void pushDownPredicateOneFilterTest() {
-        Plan scan = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of("student"));
+        Plan scan = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of(""));
         Slot gender = scan.getOutput().get(1);
         Slot age = scan.getOutput().get(3);
 
@@ -130,7 +130,7 @@ public class PushDownPredicateThroughAggregationTest {
      */
     @Test
     public void pushDownPredicateTwoFilterTest() {
-        Plan scan = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of("student"));
+        Plan scan = new LogicalOlapScan(PlanConstructor.student, 
ImmutableList.of(""));
         Slot gender = scan.getOutput().get(1);
         Slot name = scan.getOutput().get(2);
         Slot age = scan.getOutput().get(3);
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/StatsCalculatorTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/StatsCalculatorTest.java
index 848db9882b..0f47477f4c 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/StatsCalculatorTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/StatsCalculatorTest.java
@@ -225,8 +225,8 @@ public class StatsCalculatorTest {
             }};
 
         OlapTable table1 = PlanConstructor.newOlapTable(tableId1, "t1", 0);
-        LogicalOlapScan logicalOlapScan1 = new LogicalOlapScan(table1, 
Collections.emptyList()).withLogicalProperties(
-                Optional.of(new LogicalProperties(() -> 
ImmutableList.of(slot1))));
+        LogicalOlapScan logicalOlapScan1 = new LogicalOlapScan(table1, 
Collections.emptyList())
+                .withLogicalProperties(Optional.of(new LogicalProperties(() -> 
ImmutableList.of(slot1))));
         Group childGroup = new Group();
         GroupExpression groupExpression = new 
GroupExpression(logicalOlapScan1, ImmutableList.of(childGroup));
         Group ownerGroup = new Group();
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java
index 1fd9680a03..5f72875361 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java
@@ -227,9 +227,9 @@ public class PlanEqualsTest {
             
selectedTabletId.addAll(partition.getBaseIndex().getTabletIdsInOrder());
         }
 
-        PhysicalOlapScan actual = new PhysicalOlapScan(olapTable, 
Lists.newArrayList("a"), olapTable.getBaseIndexId(),
-                selectedTabletId, olapTable.getPartitionIds(), 
distributionSpecHash, Optional.empty(),
-                logicalProperties);
+        PhysicalOlapScan actual = new PhysicalOlapScan(olapTable, 
Lists.newArrayList("a"),
+                olapTable.getBaseIndexId(), selectedTabletId, 
olapTable.getPartitionIds(), distributionSpecHash,
+                Optional.empty(), logicalProperties);
 
         PhysicalOlapScan expected = new PhysicalOlapScan(olapTable, 
Lists.newArrayList("a"),
                 olapTable.getBaseIndexId(), selectedTabletId, 
olapTable.getPartitionIds(), distributionSpecHash,
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanOutputTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanOutputTest.java
index 9bfff12def..8cc59e7c5d 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanOutputTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanOutputTest.java
@@ -82,7 +82,7 @@ public class PlanOutputTest {
     @Test
     public void testPhysicalPlanMustHaveLogicalProperties() {
         Assertions.assertThrows(NullPointerException.class, () ->
-                new PhysicalRelation(PlanType.PHYSICAL_OLAP_SCAN, 
ImmutableList.of("tbl"), Optional.empty(), null) {
+                new PhysicalRelation(PlanType.PHYSICAL_OLAP_SCAN, 
ImmutableList.of("db"), Optional.empty(), null) {
                     @Override
                     public Plan withGroupExpression(Optional<GroupExpression> 
groupExpression) {
                         return null;
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanToStringTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanToStringTest.java
index 63822eeaaf..5493ca9c6a 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanToStringTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanToStringTest.java
@@ -82,7 +82,7 @@ public class PlanToStringTest {
     public void testLogicalOlapScan() {
         LogicalOlapScan plan = PlanConstructor.newLogicalOlapScan(0, "table", 
0);
         Assertions.assertTrue(
-                plan.toString().matches("LogicalOlapScan \\( 
qualifier=db\\.table, output=\\[id#\\d+, name#\\d+] \\)"));
+                plan.toString().matches("LogicalOlapScan \\( 
qualified=db\\.table, output=\\[id#\\d+, name#\\d+] \\)"));
     }
 
     @Test
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanConstructor.java 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanConstructor.java
index 0d46c71d03..4bad76c26e 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanConstructor.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanConstructor.java
@@ -22,6 +22,7 @@ import org.apache.doris.catalog.Column;
 import org.apache.doris.catalog.HashDistributionInfo;
 import org.apache.doris.catalog.KeysType;
 import org.apache.doris.catalog.OlapTable;
+import org.apache.doris.catalog.PartitionInfo;
 import org.apache.doris.catalog.Type;
 import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan;
 import org.apache.doris.thrift.TStorageType;
@@ -41,31 +42,31 @@ public class PlanConstructor {
                         new Column("gender", Type.INT, false, 
AggregateType.NONE, "0", ""),
                         new Column("name", Type.STRING, true, 
AggregateType.NONE, "", ""),
                         new Column("age", Type.INT, true, AggregateType.NONE, 
"", "")),
-                KeysType.PRIMARY_KEYS, null, null);
-        score = new OlapTable(1L, "course",
+                KeysType.PRIMARY_KEYS, new PartitionInfo(), null);
+        score = new OlapTable(1L, "score",
                 ImmutableList.<Column>of(new Column("sid", Type.INT, true, 
AggregateType.NONE, "0", ""),
                         new Column("cid", Type.INT, true, AggregateType.NONE, 
"", ""),
                         new Column("grade", Type.DOUBLE, true, 
AggregateType.NONE, "", "")),
-                KeysType.PRIMARY_KEYS, null, null);
+                KeysType.PRIMARY_KEYS, new PartitionInfo(), null);
         course = new OlapTable(2L, "course",
                 ImmutableList.<Column>of(new Column("cid", Type.INT, true, 
AggregateType.NONE, "0", ""),
                         new Column("name", Type.STRING, true, 
AggregateType.NONE, "", ""),
                         new Column("teacher", Type.STRING, true, 
AggregateType.NONE, "", "")),
-                KeysType.PRIMARY_KEYS, null, null);
+                KeysType.PRIMARY_KEYS, new PartitionInfo(), null);
         student.setIndexMeta(-1,
-                "base",
+                "student",
                 student.getFullSchema(),
                 0, 0, (short) 0,
                 TStorageType.COLUMN,
                 KeysType.PRIMARY_KEYS);
         score.setIndexMeta(-1,
-                "base",
+                "score",
                 score.getFullSchema(),
                 0, 0, (short) 0,
                 TStorageType.COLUMN,
                 KeysType.PRIMARY_KEYS);
         course.setIndexMeta(-1,
-                "base",
+                "course",
                 course.getFullSchema(),
                 0, 0, (short) 0,
                 TStorageType.COLUMN,
@@ -81,9 +82,9 @@ public class PlanConstructor {
                 ImmutableList.of(columns.get(hashColumn)));
 
         OlapTable table = new OlapTable(tableId, tableName, columns,
-                KeysType.PRIMARY_KEYS, null, hashDistributionInfo);
+                KeysType.PRIMARY_KEYS, new PartitionInfo(), 
hashDistributionInfo);
         table.setIndexMeta(-1,
-                "base",
+                tableName,
                 table.getFullSchema(),
                 0, 0, (short) 0,
                 TStorageType.COLUMN,


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

Reply via email to