This pull request includes some implementations of the statistics(https://github.com/apache/incubator-doris/issues/6370). Execute these sql such as "`ANALYZE`, `SHOW ANALYZE`, `SHOW TABLE/COLUMN STATS...`" to collect statistics information and query them. The following are the changes in this PR: 1. Added the necessary test cases for statistics. 2. Statistics optimization. To ensure the validity of statistics, statistics can only be updated after the statistics task is completed or manually updated by SQL, and the collected statistics should not be changed in other ways. The reason is to ensure that the statistics are not distorted. 3. Some code or comments have been adjusted to fix checkStyle problem. 4. Remove some code that was previously added because statistics were not available. 5. Add a configuration, which indicates whether to enable the statistics. The current statistics may not be stable, and it is not enabled by default (`enable_cbo_statistics=false`). Currently, it is mainly used for CBO test. See this PR(#12766) syntax, some simple examples of statistics: ```SQL -- enable statistics SET enable_cbo_statistics=true; -- collect statistics for all tables in the current database ANALYZE; -- collect all column statistics for table1 ANALYZE test.table1; -- collect statistics for siteid of table1 ANALYZE test.table1(siteid); ANALYZE test.table1(pv, citycode); -- collect statistics for partition of table1 ANALYZE test.table1 PARTITION(p202208); ANALYZE test.table1 PARTITIONS(p202208, p202209); -- display table statistics SHOW TABLE STATS test.table1; -- display partition statistics of table1 SHOW TABLE STATS test.table1 PARTITION(p202208); -- display column statistics of table1 SHOW COLUMN STATS test.table1; -- display column statistics of partition SHOW COLUMN STATS test.table1 PARTITION(p202208); -- display the details of the statistics jobs SHOW ANALYZE; SHOW ANALYZE idxxxx; ```
# 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. # fe-common This module is used to store some common classes of other modules. # spark-dpp This module is Spark DPP program, used for Spark Load function. Depends: fe-common # fe-core This module is the main process module of FE. Depends: fe-common, spark-dpp