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 1a7746f962e [Chore](nereids) Remove ShowColumnHistStmt (#51665)
1a7746f962e is described below

commit 1a7746f962e304e74b96638a56e9a06c10fddee0
Author: Jensen <[email protected]>
AuthorDate: Mon Jun 16 09:59:06 2025 +0800

    [Chore](nereids) Remove ShowColumnHistStmt (#51665)
---
 fe/fe-core/src/main/cup/sql_parser.cup             |   5 -
 .../apache/doris/analysis/ShowColumnHistStmt.java  | 152 ---------------------
 .../java/org/apache/doris/qe/ShowExecutor.java     |  11 --
 3 files changed, 168 deletions(-)

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index 5a22441665d..88c7be3ae83 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -4617,11 +4617,6 @@ show_param ::=
     {:
         RESULT = new ShowColumnStatsStmt(tbl, cols, partitionNames, cached);
     :}
-    /* show column histogram */
-    | KW_COLUMN KW_HISTOGRAM table_name:tbl opt_col_list:cols
-    {:
-        RESULT = new ShowColumnHistStmt(tbl, cols);
-    :}
     /* show table creation statement */
     | KW_TABLE KW_CREATION opt_db:db opt_wild_where
     {:
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowColumnHistStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowColumnHistStmt.java
deleted file mode 100644
index ae5010ffe0d..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowColumnHistStmt.java
+++ /dev/null
@@ -1,152 +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.DatabaseIf;
-import org.apache.doris.catalog.Env;
-import org.apache.doris.catalog.ScalarType;
-import org.apache.doris.catalog.TableIf;
-import org.apache.doris.catalog.Type;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.common.Pair;
-import org.apache.doris.common.UserException;
-import org.apache.doris.common.util.Util;
-import org.apache.doris.datasource.CatalogIf;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.qe.ShowResultSet;
-import org.apache.doris.qe.ShowResultSetMetaData;
-import org.apache.doris.statistics.Histogram;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-public class ShowColumnHistStmt extends ShowStmt implements 
NotFallbackInParser {
-
-    private static final ImmutableList<String> TITLE_NAMES =
-            new ImmutableList.Builder<String>()
-                    .add("column_name")
-                    .add("data_type")
-                    .add("sample_rate")
-                    .add("num_buckets")
-                    .add("buckets")
-                    .build();
-
-    private final TableName tableName;
-
-    private final List<String> columnNames;
-
-    private TableIf table;
-
-    public ShowColumnHistStmt(TableName tableName, List<String> columnNames) {
-        this.tableName = tableName;
-        this.columnNames = columnNames;
-    }
-
-    public TableName getTableName() {
-        return tableName;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-        tableName.analyze(analyzer);
-
-        // disallow external catalog
-        Util.prohibitExternalCatalog(tableName.getCtl(), 
this.getClass().getSimpleName());
-        CatalogIf<DatabaseIf> catalog = 
Env.getCurrentEnv().getCatalogMgr().getCatalog(tableName.getCtl());
-        if (catalog == null) {
-            ErrorReport.reportAnalysisException("Catalog: {} not exists", 
tableName.getCtl());
-        }
-        DatabaseIf<TableIf> db = catalog.getDb(tableName.getDb()).orElse(null);
-        if (db == null) {
-            ErrorReport.reportAnalysisException("DB: {} not exists", 
tableName.getDb());
-        }
-        table = db.getTable(tableName.getTbl()).orElse(null);
-        if (table == null) {
-            ErrorReport.reportAnalysisException("Table: {} not exists", 
tableName.getTbl());
-        }
-
-        if (!Env.getCurrentEnv().getAccessManager()
-                .checkTblPriv(ConnectContext.get(), tableName.getCtl(), 
tableName.getDb(), tableName.getTbl(),
-                        PrivPredicate.SHOW)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, 
"Permission denied",
-                    ConnectContext.get().getQualifiedUser(), 
ConnectContext.get().getRemoteIP(),
-                    tableName.getDb() + ": " + tableName.getTbl());
-        }
-
-        if (columnNames != null) {
-            Optional<Column> nullColumn = columnNames.stream()
-                    .map(table::getColumn)
-                    .filter(Objects::isNull)
-                    .findFirst();
-            if (nullColumn.isPresent()) {
-                ErrorReport.reportAnalysisException("Column: {} not exists", 
nullColumn.get());
-            }
-        }
-    }
-
-    @Override
-    public ShowResultSetMetaData getMetaData() {
-        ShowResultSetMetaData.Builder builder = 
ShowResultSetMetaData.builder();
-
-        for (String title : TITLE_NAMES) {
-            builder.addColumn(new Column(title, ScalarType.createVarchar(30)));
-        }
-        return builder.build();
-    }
-
-    public TableIf getTable() {
-        return table;
-    }
-
-    public ShowResultSet constructResultSet(List<Pair<String, Histogram>> 
columnStatistics) {
-        List<List<String>> result = Lists.newArrayList();
-        columnStatistics.forEach(p -> {
-            if (p.second == null || p.second.dataType == Type.NULL) {
-                return;
-            }
-            List<String> row = Lists.newArrayList();
-            row.add(p.first);
-            row.add(String.valueOf(p.second.dataType));
-            row.add(String.valueOf(p.second.sampleRate));
-            row.add(String.valueOf(p.second.numBuckets));
-            row.add(Histogram.getBucketsJson(p.second.buckets).toString());
-            result.add(row);
-        });
-
-        return new ShowResultSet(getMetaData(), result);
-    }
-
-    public Set<String> getColumnNames() {
-        if (columnNames != null) {
-            return  Sets.newHashSet(columnNames);
-        }
-        return table.getColumns().stream()
-                .map(Column::getName).collect(Collectors.toSet());
-    }
-}
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 a8e041490a8..859bbd1aac0 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
@@ -39,7 +39,6 @@ import org.apache.doris.analysis.ShowCharsetStmt;
 import org.apache.doris.analysis.ShowCloudWarmUpStmt;
 import org.apache.doris.analysis.ShowClusterStmt;
 import org.apache.doris.analysis.ShowCollationStmt;
-import org.apache.doris.analysis.ShowColumnHistStmt;
 import org.apache.doris.analysis.ShowColumnStatsStmt;
 import org.apache.doris.analysis.ShowColumnStmt;
 import org.apache.doris.analysis.ShowConfigStmt;
@@ -216,7 +215,6 @@ import org.apache.doris.rpc.RpcException;
 import org.apache.doris.statistics.AnalysisInfo;
 import org.apache.doris.statistics.AutoAnalysisPendingJob;
 import org.apache.doris.statistics.ColumnStatistic;
-import org.apache.doris.statistics.Histogram;
 import org.apache.doris.statistics.PartitionColumnStatistic;
 import org.apache.doris.statistics.PartitionColumnStatisticCacheKey;
 import org.apache.doris.statistics.ResultRow;
@@ -435,8 +433,6 @@ public class ShowExecutor {
             handleShowTableStats();
         } else if (stmt instanceof ShowColumnStatsStmt) {
             handleShowColumnStats();
-        } else if (stmt instanceof ShowColumnHistStmt) {
-            handleShowColumnHist();
         } else if (stmt instanceof ShowTableCreationStmt) {
             handleShowTableCreation();
         } else if (stmt instanceof ShowLastInsertStmt) {
@@ -2590,13 +2586,6 @@ public class ShowExecutor {
         return ret;
     }
 
-    public void handleShowColumnHist() {
-        // TODO: support histogram in the future.
-        ShowColumnHistStmt showColumnHistStmt = (ShowColumnHistStmt) stmt;
-        List<Pair<String, Histogram>> columnStatistics = Lists.newArrayList();
-        resultSet = showColumnHistStmt.constructResultSet(columnStatistics);
-    }
-
     public void handleShowSqlBlockRule() throws AnalysisException {
         ShowSqlBlockRuleStmt showStmt = (ShowSqlBlockRuleStmt) stmt;
         List<List<String>> rows = Lists.newArrayList();


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

Reply via email to