EmmyMiao87 commented on a change in pull request #6420:
URL: https://github.com/apache/incubator-doris/pull/6420#discussion_r687386051



##########
File path: fe/fe-core/src/main/cup/sql_parser.cup
##########
@@ -263,7 +263,7 @@ terminal String KW_ADD, KW_ADMIN, KW_AFTER, KW_AGGREGATE, 
KW_ALIAS, KW_ALL, KW_A
     KW_RIGHT, KW_ROLE, KW_ROLES, KW_ROLLBACK, KW_ROLLUP, KW_ROUTINE, KW_ROW, 
KW_ROWS,
     KW_S3, KW_SCHEMA, KW_SCHEMAS, KW_SECOND, KW_SELECT, KW_SEMI, 
KW_SERIALIZABLE, KW_SESSION, KW_SET, KW_SETS, KW_SET_VAR, KW_SHOW, KW_SIGNED,
     KW_SKEW,
-    KW_SMALLINT, KW_SNAPSHOT, KW_SONAME, KW_SPLIT, KW_START, KW_STATUS, 
KW_STOP, KW_STORAGE, KW_STREAM, KW_STRING, KW_STRUCT,
+    KW_SMALLINT, KW_SNAPSHOT, KW_SONAME, KW_SPLIT, KW_START, KW_STATUS, 
KW_STATS, KW_STOP, KW_STORAGE, KW_STREAM, KW_STRING, KW_STRUCT,

Review comment:
       done

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsManager.java
##########
@@ -0,0 +1,70 @@
+// 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.statistics;
+
+import org.apache.doris.analysis.AlterColumnStatsStmt;
+import org.apache.doris.analysis.AlterTableStatsStmt;
+import org.apache.doris.analysis.TableName;
+import org.apache.doris.catalog.Catalog;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.Database;
+import org.apache.doris.catalog.Table;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.DdlException;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+
+public class StatisticsManager {
+    private Statistics statistics;
+
+    public StatisticsManager() {
+        statistics = new Statistics();
+    }
+
+    public void alterTableStatistics(AlterTableStatsStmt stmt)
+            throws DdlException, AnalysisException {
+        Table table = validateTableName(stmt.getTableName());
+        statistics.updateTableStats(table.getId(), stmt.getProperties());
+    }
+
+    public void alterColumnStatistics(AlterColumnStatsStmt stmt) throws 
DdlException, AnalysisException {
+        Table table = validateTableName(stmt.getTableName());
+        String columnName = stmt.getColumnName();
+        Column column = table.getColumn(columnName);
+        if (column == null) {
+            ErrorReport.reportDdlException(ErrorCode.ERR_BAD_FIELD_ERROR, 
columnName);
+        }
+        // match type and column value
+        statistics.updateColumnStats(table.getId(), columnName, 
column.getType(), stmt.getProperties());

Review comment:
       use concurrent map instead




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to