This is an automated email from the ASF dual-hosted git repository.
starocean999 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 62087a23f07 [Chore](nereids) remove LabelName (#57835)
62087a23f07 is described below
commit 62087a23f071fa4b6adf502daf8e57170527dae3
Author: yaoxiao <[email protected]>
AuthorDate: Mon Nov 10 14:58:07 2025 +0800
[Chore](nereids) remove LabelName (#57835)
---
.../java/org/apache/doris/analysis/JobName.java | 47 -------------
.../java/org/apache/doris/analysis/LabelName.java | 81 ----------------------
.../apache/doris/cloud/load/CloudLoadManager.java | 2 +-
.../org/apache/doris/load/loadv2/BulkLoadJob.java | 4 +-
.../org/apache/doris/load/loadv2/LoadManager.java | 4 +-
.../doris/nereids/parser/LogicalPlanBuilder.java | 3 +-
.../nereids/trees/plans/commands/LoadCommand.java | 18 ++---
.../trees/plans/commands/info/CopyIntoInfo.java | 9 ++-
.../trees/plans/commands/info/LabelNameInfo.java | 9 ---
.../apache/doris/service/FrontendServiceImpl.java | 5 +-
.../load/routineload/KafkaRoutineLoadJobTest.java | 2 -
.../trees/plans/commands/LoadCommandTest.java | 6 +-
12 files changed, 24 insertions(+), 166 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/JobName.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/JobName.java
deleted file mode 100644
index 924083b4d45..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/JobName.java
+++ /dev/null
@@ -1,47 +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.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.common.AnalysisException;
-
-public class JobName {
- private String jobName;
- private String dbName;
-
- public JobName(String dbName, String jobName) {
- this.dbName = dbName;
- this.jobName = jobName;
- }
-
- public String getDbName() {
- return dbName;
- }
-
- public String getName() {
- return jobName;
- }
-
- public void analyze() throws AnalysisException {
- }
-
- public String toSql() {
- StringBuilder sb = new StringBuilder();
-
sb.append("`").append(dbName).append("`.`").append(jobName).append("`");
- return sb.toString();
- }
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/LabelName.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/LabelName.java
deleted file mode 100644
index 666a489d3b1..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LabelName.java
+++ /dev/null
@@ -1,81 +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.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.common.AnalysisException;
-
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-
-// TODO(tsy): maybe better to rename as `LoadLabel`
-// label name used to identify a load job
-public class LabelName {
- private String dbName;
- private String labelName;
-
- public LabelName() {
-
- }
-
- public LabelName(String dbName, String labelName) {
- this.dbName = dbName;
- this.labelName = labelName;
- }
-
- public String getDbName() {
- return dbName;
- }
-
- public void setDbName(String dbName) {
- this.dbName = dbName;
- }
-
- public String getLabelName() {
- return labelName;
- }
-
- public void analyze() throws AnalysisException {
- }
-
- @Override
- public boolean equals(Object rhs) {
- if (this == rhs) {
- return true;
- }
- if (rhs instanceof LabelName) {
- LabelName rhsLabel = (LabelName) rhs;
- return this.dbName.equals(rhsLabel.dbName) &&
this.labelName.equals(rhsLabel.labelName);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return new
HashCodeBuilder().append(dbName).append(labelName).toHashCode();
- }
-
- public String toSql() {
- StringBuilder stringBuilder = new StringBuilder();
-
stringBuilder.append("`").append(dbName).append("`.`").append(labelName).append("`");
- return stringBuilder.toString();
- }
-
- @Override
- public String toString() {
- return toSql();
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/cloud/load/CloudLoadManager.java
b/fe/fe-core/src/main/java/org/apache/doris/cloud/load/CloudLoadManager.java
index d63426cec54..16175ab42c2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/cloud/load/CloudLoadManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/load/CloudLoadManager.java
@@ -85,7 +85,7 @@ public class CloudLoadManager extends LoadManager {
}
loadJob = new CopyJob(
dbId,
- copyIntoInfo.getLabel().getLabelName(),
+ copyIntoInfo.getLabel().getLabel(),
ConnectContext.get().queryId(),
copyIntoInfo.getBrokerDesc(),
copyIntoInfo.getOriginStmt(),
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/BulkLoadJob.java
b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/BulkLoadJob.java
index 5c0ef0516d4..a38273ad540 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/BulkLoadJob.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/BulkLoadJob.java
@@ -118,7 +118,7 @@ public abstract class BulkLoadJob extends LoadJob
implements GsonPostProcessable
public static BulkLoadJob fromLoadCommand(LoadCommand command,
StmtExecutor executor, ConnectContext ctx)
throws Exception {
// get db id
- String dbName = command.getLabel().getDbName();
+ String dbName = command.getLabel().getDb();
Database db =
Env.getCurrentInternalCatalog().getDbOrDdlException(dbName);
// create job
@@ -127,7 +127,7 @@ public abstract class BulkLoadJob extends LoadJob
implements GsonPostProcessable
switch (command.getEtlJobType()) {
case BROKER:
bulkLoadJob =
EnvFactory.getInstance().createBrokerLoadJob(db.getId(),
- command.getLabel().getLabelName(),
command.getBrokerDesc(), executor.getOriginStmt(),
+ command.getLabel().getLabel(),
command.getBrokerDesc(), executor.getOriginStmt(),
command.getUserIdentity());
break;
case DELETE:
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
index 30021c5520a..7bb59ebbe72 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
@@ -121,12 +121,12 @@ public class LoadManager implements Writable {
}
}
- Database database = checkDb(command.getLabel().getDbName());
+ Database database = checkDb(command.getLabel().getDb());
long dbId = database.getId();
LoadJob loadJob;
writeLock();
try {
- checkLabelUsed(dbId, command.getLabel().getLabelName());
+ checkLabelUsed(dbId, command.getLabel().getLabel());
if (command.getBrokerDesc() == null && command.getResourceDesc()
== null) {
throw new DdlException("LoadManager only support the broker
and spark load.");
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index 38902d90001..f9c3b2e2b2e 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -26,7 +26,6 @@ import org.apache.doris.analysis.ColumnPosition;
import org.apache.doris.analysis.DbName;
import org.apache.doris.analysis.EncryptKeyName;
import org.apache.doris.analysis.FunctionName;
-import org.apache.doris.analysis.LabelName;
import org.apache.doris.analysis.LockTable;
import org.apache.doris.analysis.PassVar;
import org.apache.doris.analysis.PasswordOptions;
@@ -2138,7 +2137,7 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
String commentSpec = ctx.commentSpec() == null ? "''" :
ctx.commentSpec().STRING_LITERAL().getText();
String comment =
LogicalPlanBuilderAssistant.escapeBackSlash(commentSpec.substring(1,
commentSpec.length() - 1));
- return new LoadCommand(new LabelName(labelDbName, labelName),
dataDescriptions, brokerDesc,
+ return new LoadCommand(new LabelNameInfo(labelDbName, labelName),
dataDescriptions, brokerDesc,
resourceDesc, mutableProperties, comment);
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/LoadCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/LoadCommand.java
index 7236898ed43..aae70d34376 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/LoadCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/LoadCommand.java
@@ -18,7 +18,6 @@
package org.apache.doris.nereids.trees.plans.commands;
import org.apache.doris.analysis.BrokerDesc;
-import org.apache.doris.analysis.LabelName;
import org.apache.doris.analysis.ResourceDesc;
import org.apache.doris.analysis.StmtType;
import org.apache.doris.analysis.UserIdentity;
@@ -42,6 +41,7 @@ import org.apache.doris.load.loadv2.LoadTask;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.nereids.load.NereidsDataDescription;
import org.apache.doris.nereids.trees.plans.PlanType;
+import org.apache.doris.nereids.trees.plans.commands.info.LabelNameInfo;
import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.StmtExecutor;
@@ -205,7 +205,7 @@ public class LoadCommand extends Command implements
NeedAuditEncryption, Forward
.put(PRIORITY, (Function<String, LoadTask.Priority>) s ->
LoadTask.Priority.valueOf(s))
.build();
private static final Logger LOG = LogManager.getLogger(LoadCommand.class);
- private final LabelName label;
+ private final LabelNameInfo label;
private final List<NereidsDataDescription> dataDescriptions;
private final BrokerDesc brokerDesc;
private final ResourceDesc resourceDesc;
@@ -221,7 +221,7 @@ public class LoadCommand extends Command implements
NeedAuditEncryption, Forward
/**
* constructor of LoadCommand
*/
- public LoadCommand(LabelName label, List<NereidsDataDescription>
dataDescriptions, BrokerDesc brokerDesc,
+ public LoadCommand(LabelNameInfo label, List<NereidsDataDescription>
dataDescriptions, BrokerDesc brokerDesc,
ResourceDesc resourceDesc, Map<String, String>
properties, String comment) {
super(PlanType.LOAD_COMMAND);
this.label = label;
@@ -236,7 +236,7 @@ public class LoadCommand extends Command implements
NeedAuditEncryption, Forward
return etlJobType;
}
- public LabelName getLabel() {
+ public LabelNameInfo getLabel() {
return label;
}
@@ -345,7 +345,7 @@ public class LoadCommand extends Command implements
NeedAuditEncryption, Forward
if (!partialUpdateNewKeyPolicyProperty.equalsIgnoreCase("append")
&&
!partialUpdateNewKeyPolicyProperty.equalsIgnoreCase("error")) {
throw new DdlException(PARTIAL_UPDATE_NEW_KEY_POLICY + "
should be one of [append, error], but found "
- + partialUpdateNewKeyPolicyProperty);
+ + partialUpdateNewKeyPolicyProperty);
}
}
@@ -382,13 +382,13 @@ public class LoadCommand extends Command implements
NeedAuditEncryption, Forward
@Override
public void run(ConnectContext ctx, StmtExecutor executor) throws
Exception {
- if (Strings.isNullOrEmpty(label.getDbName())) {
+ if (Strings.isNullOrEmpty(label.getDb())) {
if (Strings.isNullOrEmpty(ctx.getDatabase())) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
}
- label.setDbName(ctx.getDatabase());
+ label.setDb(ctx.getDatabase());
}
- FeNameFormat.checkLabel(label.getLabelName());
+ FeNameFormat.checkLabel(label.getLabel());
if (dataDescriptions == null || dataDescriptions.isEmpty()) {
throw new AnalysisException("No data file in load statement.");
@@ -401,7 +401,7 @@ public class LoadCommand extends Command implements
NeedAuditEncryption, Forward
if (brokerDesc == null && resourceDesc == null) {
dataDescription.setIsHadoopLoad(true);
}
- String fullDbName =
dataDescription.analyzeFullDbName(label.getDbName(), ctx);
+ String fullDbName =
dataDescription.analyzeFullDbName(label.getDb(), ctx);
dataDescription.analyze(fullDbName);
if (dataDescription.isLoadFromTable()) {
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CopyIntoInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CopyIntoInfo.java
index 3d5b74b133d..816de09de39 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CopyIntoInfo.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CopyIntoInfo.java
@@ -23,7 +23,6 @@ import org.apache.doris.analysis.CopyFromParam;
import org.apache.doris.analysis.CopyIntoProperties;
import org.apache.doris.analysis.DataDescription;
import org.apache.doris.analysis.Expr;
-import org.apache.doris.analysis.LabelName;
import org.apache.doris.analysis.Separator;
import org.apache.doris.analysis.SlotRef;
import org.apache.doris.analysis.StageAndPattern;
@@ -114,7 +113,7 @@ public class CopyIntoInfo {
private CopyIntoProperties copyIntoProperties;
private Map<String, Map<String, String>> optHints;
- private LabelName label = null;
+ private LabelNameInfo label = null;
private BrokerDesc brokerDesc = null;
private DataDescription dataDescription = null;
private final Map<String, String> brokerProperties = new HashMap<>();
@@ -187,7 +186,7 @@ public class CopyIntoInfo {
throw new IllegalStateException("Table name [" + nameParts +
"] is invalid.");
}
tableNameInfo = new TableNameInfo(ctl, db, table);
- label = new LabelName(tableNameInfo.getDb(), labelName);
+ label = new LabelNameInfo(tableNameInfo.getDb(), labelName);
if (stage.isEmpty()) {
throw new AnalysisException("Stage name can not be empty");
}
@@ -382,7 +381,7 @@ public class CopyIntoInfo {
}
public String getDbName() {
- return label.getDbName();
+ return label.getDb();
}
public BrokerDesc getBrokerDesc() {
@@ -397,7 +396,7 @@ public class CopyIntoInfo {
return properties;
}
- public LabelName getLabel() {
+ public LabelNameInfo getLabel() {
return label;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/LabelNameInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/LabelNameInfo.java
index c314b5bce0d..321172c2c21 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/LabelNameInfo.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/LabelNameInfo.java
@@ -20,7 +20,6 @@
package org.apache.doris.nereids.trees.plans.commands.info;
-import org.apache.doris.analysis.LabelName;
import org.apache.doris.catalog.Env;
import org.apache.doris.common.FeNameFormat;
import org.apache.doris.nereids.exceptions.AnalysisException;
@@ -97,12 +96,4 @@ public class LabelNameInfo {
public String getLabel() {
return label;
}
-
- /**
- * transferToLabelName
- * @return LabelName
- */
- public LabelName transferToLabelName() {
- return new LabelName(db, label);
- }
}
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 bb17eefec7e..39eb0da3cc5 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
@@ -19,7 +19,6 @@ package org.apache.doris.service;
import org.apache.doris.analysis.AbstractBackupTableRefClause;
import org.apache.doris.analysis.AddPartitionClause;
-import org.apache.doris.analysis.LabelName;
import org.apache.doris.analysis.PartitionExprUtil;
import org.apache.doris.analysis.SetType;
import org.apache.doris.analysis.UserIdentity;
@@ -3157,7 +3156,7 @@ public class FrontendServiceImpl implements
FrontendService.Iface {
TStatus status = new TStatus(TStatusCode.OK);
result.setStatus(status);
- LabelName label = new LabelName(request.getDb(),
request.getLabelName());
+ LabelNameInfo label = new LabelNameInfo(request.getDb(),
request.getLabelName());
String repoName = request.getRepoName();
Map<String, String> properties = request.getProperties();
@@ -3230,7 +3229,7 @@ public class FrontendServiceImpl implements
FrontendService.Iface {
}
//instantiate RestoreCommand
- LabelNameInfo labelNameInfo = new LabelNameInfo(label.getDbName(),
label.getLabelName());
+ LabelNameInfo labelNameInfo = new LabelNameInfo(label.getDb(),
label.getLabel());
List<TableRefInfo> tableRefInfos = restoreTableRefClause == null
? new ArrayList<>() : restoreTableRefClause.getTableRefList();
RestoreCommand restoreCommand = new RestoreCommand(labelNameInfo,
repoName, tableRefInfos, properties, false);
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/load/routineload/KafkaRoutineLoadJobTest.java
b/fe/fe-core/src/test/java/org/apache/doris/load/routineload/KafkaRoutineLoadJobTest.java
index 7ae0b9cdbe3..7d6cf67367f 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/load/routineload/KafkaRoutineLoadJobTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/load/routineload/KafkaRoutineLoadJobTest.java
@@ -18,7 +18,6 @@
package org.apache.doris.load.routineload;
import org.apache.doris.analysis.ImportSequenceStmt;
-import org.apache.doris.analysis.LabelName;
import org.apache.doris.analysis.Separator;
import org.apache.doris.analysis.UserIdentity;
import org.apache.doris.catalog.Database;
@@ -78,7 +77,6 @@ public class KafkaRoutineLoadJobTest {
private String jobName = "job1";
private String dbName = "db1";
- private LabelName labelName = new LabelName(dbName, jobName);
private LabelNameInfo labelNameInfo = new LabelNameInfo(dbName, jobName);
private String tableNameString = "table1";
private String topicName = "topic1";
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/LoadCommandTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/LoadCommandTest.java
index 50b9da79c5b..6a0c9ffab39 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/LoadCommandTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/LoadCommandTest.java
@@ -18,7 +18,6 @@
package org.apache.doris.nereids.trees.plans.commands;
import org.apache.doris.analysis.BrokerDesc;
-import org.apache.doris.analysis.LabelName;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.Pair;
import org.apache.doris.datasource.property.fileformat.CsvFileFormatProperties;
@@ -32,6 +31,7 @@ import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.GreaterThan;
import org.apache.doris.nereids.trees.expressions.literal.IntegerLikeLiteral;
import org.apache.doris.nereids.trees.expressions.literal.StringLikeLiteral;
+import org.apache.doris.nereids.trees.plans.commands.info.LabelNameInfo;
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.thrift.TFileFormatType;
import org.apache.doris.thrift.TFileType;
@@ -196,9 +196,9 @@ public class LoadCommandTest extends TestWithFeService {
Assertions.assertTrue(loadProperties.get("exec_mem_limit").equalsIgnoreCase("8589934592"));
// label
- LabelName labelName = command.getLabel();
+ LabelNameInfo labelName = command.getLabel();
Assertions.assertNotNull(labelName);
- Assertions.assertEquals("customer_lable_for_test",
labelName.getLabelName());
+ Assertions.assertEquals("customer_lable_for_test",
labelName.getLabel());
// comment
String comment = command.getComment();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]