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 3ff548f22db [Chore](nereids) Remove ShowCreateLoadStmt (#54379)
3ff548f22db is described below
commit 3ff548f22dbace67ff22008c7715db9c87a72e04
Author: csding <[email protected]>
AuthorDate: Fri Aug 8 14:17:41 2025 +0800
[Chore](nereids) Remove ShowCreateLoadStmt (#54379)
---
fe/fe-core/src/main/cup/sql_parser.cup | 7 --
.../apache/doris/analysis/ShowCreateLoadStmt.java | 67 ----------
.../java/org/apache/doris/qe/ShowExecutor.java | 136 ---------------------
3 files changed, 210 deletions(-)
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup
b/fe/fe-core/src/main/cup/sql_parser.cup
index 05bb3a10788..19cbc10bdd9 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -2479,13 +2479,6 @@ load_property ::=
:}
;
-show_create_load_stmt ::=
- KW_SHOW KW_CREATE KW_LOAD KW_FOR job_label:jobLabel
- {:
- RESULT = new ShowCreateLoadStmt(jobLabel);
- :}
- ;
-
tbl_pattern ::=
ident_or_star:db
{:
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowCreateLoadStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowCreateLoadStmt.java
deleted file mode 100644
index 858f89d154b..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowCreateLoadStmt.java
+++ /dev/null
@@ -1,67 +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.catalog.Column;
-import org.apache.doris.catalog.Env;
-import org.apache.doris.catalog.ScalarType;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.qe.ShowResultSetMetaData;
-
-// SHOW CREATE LOAD statement.
-public class ShowCreateLoadStmt extends ShowStmt implements
NotFallbackInParser {
-
- private static final ShowResultSetMetaData META_DATA =
- ShowResultSetMetaData.builder()
- .addColumn(new Column("JobId",
ScalarType.createVarchar(128)))
- .addColumn(new Column("CreateStmt",
ScalarType.createVarchar(65535)))
- .build();
-
- private final LabelName labelName;
-
- public ShowCreateLoadStmt(LabelName labelName) {
- this.labelName = labelName;
- }
-
- public String getDb() {
- return labelName.getDbName();
- }
-
- public String getLabel() {
- return labelName.getLabelName();
- }
-
- @Override
- public void analyze() throws AnalysisException {
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)
- &&
!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
- PrivPredicate.OPERATOR)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN/OPERATOR");
- }
- labelName.analyze();
- }
-
- @Override
- public ShowResultSetMetaData getMetaData() {
- return META_DATA;
- }
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
index e09d6269da4..fecec09d759 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
@@ -20,31 +20,19 @@ package org.apache.doris.qe;
import org.apache.doris.analysis.DiagnoseTabletStmt;
import org.apache.doris.analysis.HelpStmt;
import org.apache.doris.analysis.ShowAlterStmt;
-import org.apache.doris.analysis.ShowCreateLoadStmt;
import org.apache.doris.analysis.ShowEnginesStmt;
import org.apache.doris.analysis.ShowIndexPolicyStmt;
import org.apache.doris.analysis.ShowStmt;
-import org.apache.doris.catalog.DatabaseIf;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.Function;
-import org.apache.doris.catalog.OlapTable;
-import org.apache.doris.catalog.TableIf;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.CaseSensibility;
import org.apache.doris.common.Config;
-import org.apache.doris.common.DdlException;
-import org.apache.doris.common.Pair;
import org.apache.doris.common.proc.ProcNodeInterface;
import org.apache.doris.common.proc.RollupProcDir;
import org.apache.doris.common.proc.SchemaChangeProcDir;
-import org.apache.doris.common.util.Util;
import org.apache.doris.qe.help.HelpModule;
import org.apache.doris.qe.help.HelpTopic;
-import org.apache.doris.statistics.ColumnStatistic;
-import org.apache.doris.statistics.PartitionColumnStatistic;
-import org.apache.doris.statistics.PartitionColumnStatisticCacheKey;
-import org.apache.doris.statistics.ResultRow;
-import org.apache.doris.statistics.StatisticsRepository;
import org.apache.doris.system.Diagnoser;
import com.google.common.base.Preconditions;
@@ -52,12 +40,8 @@ import com.google.common.collect.Lists;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
// Execute one show statement.
public class ShowExecutor {
@@ -80,8 +64,6 @@ public class ShowExecutor {
handleHelp();
} else if (stmt instanceof ShowEnginesStmt) {
handleShowEngines();
- } else if (stmt instanceof ShowCreateLoadStmt) {
- handleShowCreateLoad();
} else if (stmt instanceof ShowAlterStmt) {
handleShowAlter();
} else if (stmt instanceof DiagnoseTabletStmt) {
@@ -219,124 +201,6 @@ public class ShowExecutor {
resultSet = new ShowResultSet(showStmt.getMetaData(), rows);
}
- private void handleShowCreateLoad() throws AnalysisException {
- ShowCreateLoadStmt showCreateLoadStmt = (ShowCreateLoadStmt) stmt;
- List<List<String>> rows = Lists.newArrayList();
- String labelName = showCreateLoadStmt.getLabel();
-
- Util.prohibitExternalCatalog(ctx.getDefaultCatalog(),
stmt.getClass().getSimpleName());
- Env env = ctx.getEnv();
- DatabaseIf db =
ctx.getCurrentCatalog().getDbOrAnalysisException(showCreateLoadStmt.getDb());
- long dbId = db.getId();
- try {
- List<Pair<Long, String>> result =
env.getLoadManager().getCreateLoadStmt(dbId, labelName);
- rows.addAll(result.stream().map(pair ->
Lists.newArrayList(String.valueOf(pair.first), pair.second))
- .collect(Collectors.toList()));
- } catch (DdlException e) {
- LOG.warn(e.getMessage(), e);
- throw new AnalysisException(e.getMessage());
- }
- resultSet = new ShowResultSet(showCreateLoadStmt.getMetaData(), rows);
- }
-
- private void getStatsForAllColumns(List<Pair<Pair<String, String>,
ColumnStatistic>> columnStatistics,
- TableIf tableIf) {
- List<ResultRow> resultRows =
StatisticsRepository.queryColumnStatisticsForTable(
- tableIf.getDatabase().getCatalog().getId(),
tableIf.getDatabase().getId(), tableIf.getId());
- // row[4] is index id, row[5] is column name.
- for (ResultRow row : resultRows) {
- String indexName = tableIf.getName();
- long indexId = Long.parseLong(row.get(4));
- if (tableIf instanceof OlapTable) {
- OlapTable olapTable = (OlapTable) tableIf;
- indexName = olapTable.getIndexNameById(indexId == -1 ?
olapTable.getBaseIndexId() : indexId);
- }
- if (indexName == null) {
- continue;
- }
- try {
- columnStatistics.add(Pair.of(Pair.of(indexName, row.get(5)),
ColumnStatistic.fromResultRow(row)));
- } catch (Exception e) {
- LOG.warn("Failed to deserialize column statistics. reason:
[{}]. Row [{}]", e.getMessage(), row);
- if (LOG.isDebugEnabled()) {
- LOG.debug(e);
- }
- }
- }
- }
-
- private void getStatsForSpecifiedColumns(List<Pair<Pair<String, String>,
ColumnStatistic>> columnStatistics,
- Set<String> columnNames, TableIf tableIf, boolean showCache)
- throws AnalysisException {
- ConnectContext connectContext = ConnectContext.get();
- for (String colName : columnNames) {
- // Olap base index use -1 as index id.
- List<Long> indexIds = Lists.newArrayList();
- if (tableIf instanceof OlapTable) {
- indexIds = ((OlapTable) tableIf).getMvColumnIndexIds(colName);
- } else {
- indexIds.add(-1L);
- }
- for (long indexId : indexIds) {
- String indexName = tableIf.getName();
- if (tableIf instanceof OlapTable) {
- OlapTable olapTable = (OlapTable) tableIf;
- indexName = olapTable.getIndexNameById(indexId == -1 ?
olapTable.getBaseIndexId() : indexId);
- }
- if (indexName == null) {
- continue;
- }
- // Show column statistics in columnStatisticsCache.
- ColumnStatistic columnStatistic;
- if (showCache) {
- columnStatistic =
Env.getCurrentEnv().getStatisticsCache().getColumnStatistics(
- tableIf.getDatabase().getCatalog().getId(),
- tableIf.getDatabase().getId(), tableIf.getId(),
indexId, colName, connectContext);
- } else {
- columnStatistic =
StatisticsRepository.queryColumnStatisticsByName(
- tableIf.getDatabase().getCatalog().getId(),
- tableIf.getDatabase().getId(), tableIf.getId(),
indexId, colName);
- }
- columnStatistics.add(Pair.of(Pair.of(indexName, colName),
columnStatistic));
- }
- }
- }
-
- private Map<PartitionColumnStatisticCacheKey, PartitionColumnStatistic>
getCachedPartitionColumnStats(
- Set<String> columnNames, List<String> partitionNames, TableIf
tableIf) {
- Map<PartitionColumnStatisticCacheKey, PartitionColumnStatistic> ret =
new HashMap<>();
- long catalogId = tableIf.getDatabase().getCatalog().getId();
- long dbId = tableIf.getDatabase().getId();
- long tableId = tableIf.getId();
- ConnectContext ctx = ConnectContext.get();
- for (String colName : columnNames) {
- // Olap base index use -1 as index id.
- List<Long> indexIds = Lists.newArrayList();
- if (tableIf instanceof OlapTable) {
- indexIds = ((OlapTable) tableIf).getMvColumnIndexIds(colName);
- } else {
- indexIds.add(-1L);
- }
- for (long indexId : indexIds) {
- String indexName = tableIf.getName();
- if (tableIf instanceof OlapTable) {
- OlapTable olapTable = (OlapTable) tableIf;
- indexName = olapTable.getIndexNameById(indexId == -1 ?
olapTable.getBaseIndexId() : indexId);
- }
- if (indexName == null) {
- continue;
- }
- for (String partName : partitionNames) {
- PartitionColumnStatistic partitionStatistics =
Env.getCurrentEnv().getStatisticsCache()
- .getPartitionColumnStatistics(catalogId, dbId,
tableId, indexId, partName, colName, ctx);
- ret.put(new PartitionColumnStatisticCacheKey(catalogId,
dbId, tableId, indexId, partName, colName),
- partitionStatistics);
- }
- }
- }
- return ret;
- }
-
private void handleAdminDiagnoseTablet() {
DiagnoseTabletStmt showStmt = (DiagnoseTabletStmt) stmt;
List<List<String>> resultRowSet =
Diagnoser.diagnoseTablet(showStmt.getTabletId());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]