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 11406e9d66e [refactor](Descriptor) remove TupleDescriptor's
TableRefInfo (#62290)
11406e9d66e is described below
commit 11406e9d66e33d919424a583e1cf1b3c122f7e94
Author: morrySnow <[email protected]>
AuthorDate: Fri Apr 10 10:35:27 2026 +0800
[refactor](Descriptor) remove TupleDescriptor's TableRefInfo (#62290)
---
.../org/apache/doris/analysis/TupleDescriptor.java | 24 ++---------
.../org/apache/doris/backup/BackupHandler.java | 10 +----
.../apache/doris/datasource/FileQueryScanNode.java | 8 ----
.../org/apache/doris/info/BaseTableRefInfo.java | 48 ----------------------
.../java/org/apache/doris/info/TableRefInfo.java | 25 +----------
.../glue/translator/PhysicalPlanTranslator.java | 22 ++--------
.../org/apache/doris/planner/OlapScanNode.java | 20 ++-------
.../apache/doris/service/FrontendServiceImpl.java | 8 +---
8 files changed, 13 insertions(+), 152 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
index 8580d046c3e..a928163ca44 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
@@ -21,7 +21,6 @@
package org.apache.doris.analysis;
import org.apache.doris.catalog.TableIf;
-import org.apache.doris.info.TableRefInfo;
import org.apache.doris.thrift.TTupleDescriptor;
import com.google.common.base.Joiner;
@@ -39,14 +38,10 @@ public class TupleDescriptor {
// underlying table, if there is one
private TableIf table;
- // underlying table, if there is one
- private TableRefInfo ref;
-
- private int tableId = -1;
public TupleDescriptor(TupleId id) {
this.id = id;
- this.slots = new ArrayList<SlotDescriptor>();
+ this.slots = new ArrayList<>();
this.idToSlotDesc = new HashMap<>();
}
@@ -59,14 +54,6 @@ public class TupleDescriptor {
return id;
}
- public TableRefInfo getRef() {
- return ref;
- }
-
- public void setRef(TableRefInfo tableRefInfo) {
- ref = tableRefInfo;
- }
-
public ArrayList<SlotDescriptor> getSlots() {
return slots;
}
@@ -111,14 +98,11 @@ public class TupleDescriptor {
}
public TTupleDescriptor toThrift() {
- TTupleDescriptor ttupleDesc = new TTupleDescriptor(id.asInt(), 0, 0);
+ TTupleDescriptor tTupleDesc = new TTupleDescriptor(id.asInt(), 0, 0);
if (table != null && table.getId() >= 0) {
- ttupleDesc.setTableId((int) table.getId());
- }
- if (tableId > 0) {
- ttupleDesc.setTableId(tableId);
+ tTupleDesc.setTableId((int) table.getId());
}
- return ttupleDesc;
+ return tTupleDesc;
}
@Override
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
index 116e28e74b5..96174e59f1b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
@@ -67,7 +67,6 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
@@ -450,14 +449,7 @@ public class BackupHandler extends MasterDaemon implements
Writable {
tableRefInfoList.addAll(tableRefInfos);
} else {
for (String tableName : tableNames) {
- TableRefInfo tableRefInfo = new TableRefInfo(new
TableNameInfo(db.getFullName(), tableName),
- null,
- null,
- null,
- new ArrayList<>(),
- null,
- null,
- new ArrayList<>());
+ TableRefInfo tableRefInfo = new TableRefInfo(new
TableNameInfo(db.getFullName(), tableName), null);
tableRefInfoList.add(tableRefInfo);
}
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java
index c2a76d8fe37..05b907ccea4 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java
@@ -666,10 +666,6 @@ public abstract class FileQueryScanNode extends
FileScanNode {
}
public TableSnapshot getQueryTableSnapshot() {
- TableSnapshot snapshot = desc.getRef().getTableSnapShot();
- if (snapshot != null) {
- return snapshot;
- }
return this.tableSnapshot;
}
@@ -678,10 +674,6 @@ public abstract class FileQueryScanNode extends
FileScanNode {
}
public TableScanParams getScanParams() {
- TableScanParams scan = desc.getRef().getScanParams();
- if (scan != null) {
- return scan;
- }
return this.scanParams;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/info/BaseTableRefInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/info/BaseTableRefInfo.java
deleted file mode 100644
index 6aa118d0314..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/info/BaseTableRefInfo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.
-// This file is copied from
-//
https://github.com/apache/impala/blob/branch-2.9.0/fe/src/main/java/org/apache/impala/SlotRef.java
-// and modified by Doris
-
-package org.apache.doris.info;
-
-import org.apache.doris.catalog.TableIf;
-
-/**
- * BaseTableRefInfo
- */
-public class BaseTableRefInfo extends TableRefInfo {
- private TableIf table;
-
- public BaseTableRefInfo(TableRefInfo tableRefInfo, TableNameInfo
tableNameInfo, TableIf table) {
- super(tableRefInfo);
- this.table = table;
- this.tableNameInfo = tableNameInfo;
- tableAlias = tableNameInfo.getTableAlias();
- }
-
- protected BaseTableRefInfo(BaseTableRefInfo other) {
- super(other);
- tableNameInfo = other.tableNameInfo;
- table = other.table;
- }
-
- @Override
- public TableRefInfo clone() {
- return new BaseTableRefInfo(this);
- }
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/info/TableRefInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/info/TableRefInfo.java
index 553f55764e9..ea2cd385019 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/info/TableRefInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/info/TableRefInfo.java
@@ -55,30 +55,7 @@ public class TableRefInfo {
* constructor
*/
public TableRefInfo(TableNameInfo tableNameInfo, String tableAlias) {
- this(tableNameInfo, null, tableAlias);
- }
-
- public TableRefInfo(TableNameInfo tableNameInfo, PartitionNamesInfo
partitionNamesInfo, String tableAlias) {
- this(tableNameInfo, partitionNamesInfo, tableAlias, new ArrayList<>());
- }
-
- public TableRefInfo(TableNameInfo tableNameInfo, PartitionNamesInfo
partitionNamesInfo,
- String tableAlias, List<String> relationHints) {
- this(tableNameInfo, partitionNamesInfo, new ArrayList<>(), tableAlias,
null, relationHints);
- }
-
- public TableRefInfo(TableNameInfo tableNameInfo, PartitionNamesInfo
partitionNamesInfo,
- List<Long> tabletIdList, String tableAlias,
- TableSample tableSample, List<String> relationHints) {
- this(tableNameInfo, null, partitionNamesInfo, tabletIdList,
tableAlias, tableSample, relationHints);
- }
-
- public TableRefInfo(TableNameInfo tableNameInfo, TableSnapshot
tableSnapShot,
- PartitionNamesInfo partitionNamesInfo,
- List<Long> tabletIdList, String tableAlias,
- TableSample tableSample, List<String> relationHints) {
- this(tableNameInfo, null, tableSnapShot, partitionNamesInfo,
- tabletIdList, tableAlias, tableSample, relationHints);
+ this(tableNameInfo, null, null, null, new ArrayList<>(), tableAlias,
null, new ArrayList<>());
}
/**
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 1a4c6e54c24..b9a88c47a24 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
@@ -69,9 +69,6 @@ import
org.apache.doris.datasource.trinoconnector.source.TrinoConnectorScanNode;
import org.apache.doris.fs.DirectoryLister;
import org.apache.doris.fs.FileSystemDirectoryLister;
import org.apache.doris.fs.TransactionScopeCachingDirectoryListerFactory;
-import org.apache.doris.info.BaseTableRefInfo;
-import org.apache.doris.info.TableNameInfo;
-import org.apache.doris.info.TableRefInfo;
import org.apache.doris.nereids.exceptions.AnalysisException;
import org.apache.doris.nereids.processor.post.runtimefilterv2.RuntimeFilterV2;
import org.apache.doris.nereids.properties.DistributionSpec;
@@ -770,7 +767,7 @@ public class PhysicalPlanTranslator extends
DefaultPlanVisitor<PlanFragment, Pla
fileScan.getTableSnapshot().ifPresent(fileQueryScanNode::setQueryTableSnapshot);
fileScan.getScanParams().ifPresent(fileQueryScanNode::setScanParams);
}
- return getPlanFragmentForPhysicalFileScan(fileScan, context, scanNode,
table, tupleDescriptor);
+ return getPlanFragmentForPhysicalFileScan(fileScan, context, scanNode);
}
@Override
@@ -846,21 +843,16 @@ public class PhysicalPlanTranslator extends
DefaultPlanVisitor<PlanFragment, Pla
hudiScanNode.setQueryTableSnapshot(hudiScan.getTableSnapshot().get());
}
hudiScanNode.setSelectedPartitions(hudiScan.getSelectedPartitions());
- return getPlanFragmentForPhysicalFileScan(hudiScan, context,
hudiScanNode, table, tupleDescriptor);
+ return getPlanFragmentForPhysicalFileScan(hudiScan, context,
hudiScanNode);
}
@NotNull
private PlanFragment getPlanFragmentForPhysicalFileScan(PhysicalFileScan
fileScan, PlanTranslatorContext context,
- ScanNode scanNode,
- ExternalTable table, TupleDescriptor tupleDescriptor) {
+ ScanNode scanNode) {
scanNode.setNereidsId(fileScan.getId());
context.getNereidsIdToPlanNodeIdMap().put(fileScan.getId(),
scanNode.getId());
scanNode.setPushDownAggNoGrouping(context.getRelationPushAggOp(fileScan.getRelationId()));
- TableNameInfo tableNameInfo = new TableNameInfo(null, "", "");
- TableRefInfo ref = new TableRefInfo(tableNameInfo, null, null);
- BaseTableRefInfo tableRefInfo = new BaseTableRefInfo(ref,
tableNameInfo, table);
- tupleDescriptor.setRef(tableRefInfo);
if (fileScan.getStats() != null) {
scanNode.setCardinality((long) fileScan.getStats().getRowCount());
}
@@ -885,10 +877,6 @@ public class PhysicalPlanTranslator extends
DefaultPlanVisitor<PlanFragment, Pla
jdbcScanNode.setNereidsId(jdbcScan.getId());
context.getNereidsIdToPlanNodeIdMap().put(jdbcScan.getId(),
jdbcScanNode.getId());
- TableNameInfo tableNameInfo = new TableNameInfo(null, "", "");
- TableRefInfo ref = new TableRefInfo(tableNameInfo, null, null);
- BaseTableRefInfo tableRefInfo = new BaseTableRefInfo(ref,
tableNameInfo, table);
- tupleDescriptor.setRef(tableRefInfo);
if (jdbcScan.getStats() != null) {
jdbcScanNode.setCardinality((long)
jdbcScan.getStats().getRowCount());
}
@@ -981,10 +969,6 @@ public class PhysicalPlanTranslator extends
DefaultPlanVisitor<PlanFragment, Pla
}
}
// TODO: Do we really need tableName here?
- TableNameInfo tableName = new TableNameInfo(null, "", "");
- TableRefInfo ref = new TableRefInfo(tableName, null, null);
- BaseTableRefInfo tableRefInfo = new BaseTableRefInfo(ref, tableName,
olapTable);
- tupleDescriptor.setRef(tableRefInfo);
olapScanNode.setSelectedPartitionIds(olapScan.getSelectedPartitionIds());
olapScanNode.setNereidsPrunedTabletIds(new
LinkedHashSet<>(olapScan.getSelectedTabletIds()));
if (olapScan.getTableSample().isPresent()) {
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 155a0a2fa6f..bf391db71f4 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
@@ -46,7 +46,6 @@ import org.apache.doris.catalog.PartitionType;
import org.apache.doris.catalog.Replica;
import org.apache.doris.catalog.ScalarType;
import org.apache.doris.catalog.Tablet;
-import org.apache.doris.catalog.info.PartitionNamesInfo;
import org.apache.doris.cloud.qe.ComputeGroupException;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.Config;
@@ -334,22 +333,10 @@ public class OlapScanNode extends ScanNode {
}
- private Collection<Long> partitionPrune(PartitionInfo partitionInfo,
- PartitionNamesInfo partitionNamesInfo) throws AnalysisException {
+ private Collection<Long> partitionPrune(PartitionInfo partitionInfo)
throws AnalysisException {
PartitionPruner partitionPruner = null;
Map<Long, PartitionItem> keyItemMap;
- if (partitionNamesInfo != null) {
- keyItemMap = Maps.newHashMap();
- for (String partName : partitionNamesInfo.getPartitionNames()) {
- Partition partition = olapTable.getPartition(partName,
partitionNamesInfo.isTemp());
- if (partition == null) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_SUCH_PARTITION, partName);
- }
- keyItemMap.put(partition.getId(),
partitionInfo.getItem(partition.getId()));
- }
- } else {
- keyItemMap = partitionInfo.getIdToItem(false);
- }
+ keyItemMap = partitionInfo.getIdToItem(false);
if (partitionInfo.getType() == PartitionType.RANGE) {
if (isPointQuery() && partitionInfo.getPartitionColumns().size()
== 1) {
// short circuit, a quick path to find partition
@@ -698,10 +685,9 @@ public class OlapScanNode extends ScanNode {
private void computePartitionInfo() throws AnalysisException {
long start = System.currentTimeMillis();
// Step1: compute partition ids
- PartitionNamesInfo partitionNames =
desc.getRef().getPartitionNamesInfo();
PartitionInfo partitionInfo = olapTable.getPartitionInfo();
if (partitionInfo.getType() == PartitionType.RANGE ||
partitionInfo.getType() == PartitionType.LIST) {
- selectedPartitionIds = partitionPrune(partitionInfo,
partitionNames);
+ selectedPartitionIds = partitionPrune(partitionInfo);
} else {
selectedPartitionIds = olapTable.getPartitionIds();
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index 6d5cbaab063..4e2cbec393d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -3916,13 +3916,7 @@ public class FrontendServiceImpl implements
FrontendService.Iface {
if (request.isSetTableRefs()) {
for (TTableRef tTableRef : request.getTableRefs()) {
tableRefs.add(new TableRefInfo(new
TableNameInfo(tTableRef.getTable()),
- null,
- null,
- null,
- new ArrayList<>(),
- tTableRef.getAliasName(),
- null,
- new ArrayList<>()));
+ tTableRef.getAliasName()));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]