This is an automated email from the ASF dual-hosted git repository.

morrysnow 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 e63739e729 [fix](nereids)  add regression test for stats analyze and 
fix some bugs (#20865)
e63739e729 is described below

commit e63739e7295a1c0e58165a418299ceb866824b11
Author: AKIRA <33112463+kikyou1...@users.noreply.github.com>
AuthorDate: Fri Jun 16 17:43:49 2023 +0900

    [fix](nereids)  add regression test for stats analyze and fix some bugs 
(#20865)
    
    1. Add regression test case for analyze to make sure show/drop/analyze 
stats would work as expected
    2. Remove useless code, which would block the clean for expired stats
    3. Fix bug of DropStats,  before this PR drop the whole table stats would 
casuse a NPE exception when parsing stmt
---
 .../org/apache/doris/analysis/AnalyzeTblStmt.java  |   9 +
 .../org/apache/doris/analysis/DropStatsStmt.java   |   4 +-
 .../doris/catalog/InternalSchemaInitializer.java   |   6 +-
 .../apache/doris/statistics/ColumnStatistic.java   |  10 +-
 .../apache/doris/statistics/StatisticsCleaner.java |  36 ---
 .../doris/statistics/util/InternalQueryResult.java |   5 +
 .../suites/statistics/analyze_stats.groovy         | 323 +++++++++++----------
 .../suites/statistics/manage_stats.groovy          | 271 -----------------
 regression-test/suites/statistics/test_ddl.groovy  |  80 +++++
 9 files changed, 267 insertions(+), 477 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeTblStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeTblStmt.java
index 01888461ae..71d25c97f6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeTblStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeTblStmt.java
@@ -164,6 +164,15 @@ public class AnalyzeTblStmt extends AnalyzeStmt {
                         + "collection of external tables is not supported");
             }
         }
+        if (analyzeProperties.isSync()
+                && (analyzeProperties.isAutomatic() || 
analyzeProperties.getPeriodTimeInMs() != 0)) {
+            throw new AnalysisException("Automatic/Period statistics 
collection "
+                    + "and synchronous statistics collection cannot be set at 
same time");
+        }
+        if (analyzeProperties.isAutomatic() && 
analyzeProperties.getPeriodTimeInMs() != 0) {
+            throw new AnalysisException("Automatic collection "
+                    + "and period statistics collection cannot be set at same 
time");
+        }
     }
 
     private void checkColumn() throws AnalysisException {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DropStatsStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DropStatsStmt.java
index df50f45bb3..1e426c586f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DropStatsStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DropStatsStmt.java
@@ -64,7 +64,9 @@ public class DropStatsStmt extends DdlStmt {
     public DropStatsStmt(TableName tableName,
             List<String> columnNames) {
         this.tableName = tableName;
-        this.columnNames = new HashSet<>(columnNames);
+        if (columnNames != null) {
+            this.columnNames = new HashSet<>(columnNames);
+        }
         dropExpired = false;
     }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/InternalSchemaInitializer.java
 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/InternalSchemaInitializer.java
index 04bbbe263a..5b3a093f77 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/InternalSchemaInitializer.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/InternalSchemaInitializer.java
@@ -145,12 +145,12 @@ public class InternalSchemaInitializer extends Thread {
         ColumnDef partId = new ColumnDef("part_id", 
TypeDef.createVarchar(StatisticConstants.MAX_NAME_LEN));
         partId.setAllowNull(true);
         columnDefs.add(partId);
-        columnDefs.add(new ColumnDef("count", 
TypeDef.create(PrimitiveType.BIGINT)));
-        columnDefs.add(new ColumnDef("ndv", 
TypeDef.create(PrimitiveType.BIGINT)));
+        columnDefs.add(new ColumnDef("count", 
TypeDef.create(PrimitiveType.BIGINT), true));
+        columnDefs.add(new ColumnDef("ndv", 
TypeDef.create(PrimitiveType.BIGINT), true));
         columnDefs.add(new ColumnDef("null_count", 
TypeDef.create(PrimitiveType.BIGINT), true));
         columnDefs.add(new ColumnDef("min", 
TypeDef.createVarchar(ScalarType.MAX_VARCHAR_LENGTH), true));
         columnDefs.add(new ColumnDef("max", 
TypeDef.createVarchar(ScalarType.MAX_VARCHAR_LENGTH), true));
-        columnDefs.add(new ColumnDef("data_size_in_bytes", 
TypeDef.create(PrimitiveType.BIGINT)));
+        columnDefs.add(new ColumnDef("data_size_in_bytes", 
TypeDef.create(PrimitiveType.BIGINT), true));
         columnDefs.add(new ColumnDef("update_time", 
TypeDef.create(PrimitiveType.DATETIME)));
         String engineName = "olap";
         ArrayList<String> uniqueKeys = Lists.newArrayList("id", "catalog_id",
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java
index 8aecb8bb4e..ddfec87c13 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java
@@ -127,17 +127,17 @@ public class ColumnStatistic {
     public static ColumnStatistic fromResultRow(ResultRow resultRow) {
         try {
             ColumnStatisticBuilder columnStatisticBuilder = new 
ColumnStatisticBuilder();
-            double count = 
Double.parseDouble(resultRow.getColumnValue("count"));
+            double count = 
Double.parseDouble(resultRow.getColumnValueWithDefault("count", "0"));
             columnStatisticBuilder.setCount(count);
-            double ndv = Double.parseDouble(resultRow.getColumnValue("ndv"));
+            double ndv = 
Double.parseDouble(resultRow.getColumnValueWithDefault("ndv", "0"));
             if (0.99 * count < ndv && ndv < 1.01 * count) {
                 ndv = count;
             }
             columnStatisticBuilder.setNdv(ndv);
-            String nullCount = resultRow.getColumnValue("null_count");
-            columnStatisticBuilder.setNumNulls(nullCount == null ? 0 : 
Double.parseDouble(nullCount));
+            String nullCount = 
resultRow.getColumnValueWithDefault("null_count", "0");
+            columnStatisticBuilder.setNumNulls(Double.parseDouble(nullCount));
             columnStatisticBuilder.setDataSize(Double
-                    
.parseDouble(resultRow.getColumnValue("data_size_in_bytes")));
+                    
.parseDouble(resultRow.getColumnValueWithDefault("data_size_in_bytes", "0")));
             
columnStatisticBuilder.setAvgSizeByte(columnStatisticBuilder.getDataSize()
                     / columnStatisticBuilder.getCount());
             long catalogId = 
Long.parseLong(resultRow.getColumnValue("catalog_id"));
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCleaner.java 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCleaner.java
index d68eb39dad..c023b9a335 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCleaner.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCleaner.java
@@ -36,14 +36,12 @@ import org.apache.commons.text.StringSubstitutor;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
-import java.util.function.BiFunction;
 import java.util.stream.Collectors;
 
 /**
@@ -57,8 +55,6 @@ public class StatisticsCleaner extends MasterDaemon {
     private OlapTable colStatsTbl;
     private OlapTable histStatsTbl;
 
-    private OlapTable jobTbl;
-
     private Map<Long, CatalogIf> idToCatalog;
 
     /* Internal DB only */
@@ -100,17 +96,6 @@ public class StatisticsCleaner extends MasterDaemon {
         } while (!expiredStats.isEmpty());
     }
 
-    private void clearJobTbl(BiFunction<Integer, Long, List<ResultRow>> 
fetchFunc, boolean taskOnly) {
-        List<String> jobIds = null;
-        long offset = 0;
-        do {
-            jobIds = new ArrayList<>();
-            offset = findExpiredJobs(jobIds, offset, fetchFunc);
-            doDelete("job_id", jobIds, FeConstants.INTERNAL_DB_NAME + "."
-                    + StatisticConstants.ANALYSIS_JOB_TABLE, taskOnly);
-        } while (!jobIds.isEmpty());
-    }
-
     private boolean init() {
         try {
             String dbName = SystemInfoService.DEFAULT_CLUSTER + ":" + 
FeConstants.INTERNAL_DB_NAME;
@@ -124,9 +109,6 @@ public class StatisticsCleaner extends MasterDaemon {
                             .findTable(InternalCatalog.INTERNAL_CATALOG_NAME,
                                     dbName,
                                     StatisticConstants.HISTOGRAM_TBL_NAME);
-            jobTbl = (OlapTable) 
StatisticsUtil.findTable(InternalCatalog.INTERNAL_CATALOG_NAME,
-                    dbName,
-                    StatisticConstants.ANALYSIS_JOB_TABLE);
         } catch (Throwable t) {
             LOG.warn("Failed to init stats cleaner", t);
             return false;
@@ -258,24 +240,6 @@ public class StatisticsCleaner extends MasterDaemon {
         return pos;
     }
 
-    private long findExpiredJobs(List<String> jobIds, long offset, 
BiFunction<Integer, Long, List<ResultRow>>
-            fetchFunc) {
-        long pos = offset;
-        while (pos < jobTbl.getRowCount() && jobIds.size() < 
Config.max_allowed_in_element_num_of_delete) {
-            List<ResultRow> rows = 
fetchFunc.apply(StatisticConstants.FETCH_LIMIT, pos);
-            for (ResultRow r : rows) {
-                try {
-                    jobIds.add(r.getColumnValue("job_id"));
-                } catch (Exception e) {
-                    LOG.warn("Error when get job_id from ResultRow", e);
-                }
-            }
-            pos += StatisticConstants.FETCH_LIMIT;
-            this.yieldForOtherTask();
-        }
-        return pos;
-    }
-
     private static class ExpiredStats {
         Set<Long> expiredCatalog = new HashSet<>();
         Set<Long> expiredDatabase = new HashSet<>();
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/util/InternalQueryResult.java
 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/util/InternalQueryResult.java
index 8df763e83e..422f7af4a9 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/util/InternalQueryResult.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/util/InternalQueryResult.java
@@ -122,6 +122,11 @@ public class InternalQueryResult {
             return values.get(index);
         }
 
+        public String getColumnValueWithDefault(String columnName, String 
defaultVal) throws DdlException {
+            String val = getColumnValue(columnName);
+            return val == null ? defaultVal : val;
+        }
+
         public Object getColumnValue(int index) throws DdlException {
             List<String> columns = getColumns();
             if (index >= 0 && index < columns.size()) {
diff --git a/regression-test/suites/statistics/analyze_stats.groovy 
b/regression-test/suites/statistics/analyze_stats.groovy
index 3479fecfc1..89de47fe89 100644
--- a/regression-test/suites/statistics/analyze_stats.groovy
+++ b/regression-test/suites/statistics/analyze_stats.groovy
@@ -15,166 +15,167 @@
 // specific language governing permissions and limitations
 // under the License.
 
-suite("test_analyze_stats") {
-
-    /**************************************** Constant definition Begin 
****************************************/
-    //    def dbName = "test_analyze_stats_db"
-    //    def tblName = "test_analyze_stats_tbl"
-    //    def fullTblName = "${dbName}.${tblName}"
-    //
-    //    def interDbName = "__internal_schema"
-    //    def analysisJobsTblName = "${interDbName}.analysis_jobs"
-    //    def colHistogramTblName = "${interDbName}.histogram_statistics"
-    //    def colStatisticsTblName = "${interDbName}.column_statistics"
-    //
-    //    def tblColumnNames = """ "c_id", "c_boolean", "c_int", "c_float", 
"c_double", "c_decimal", "c_varchar", "c_datev2" """
-    //    def colStatisticsSchema = "`col_id`, `count`, `ndv`, `null_count`, 
`min`, `max`, `data_size_in_bytes`"
-    //    def colHistogramSchema = "`col_id`, `sample_rate`, `buckets`"
-    /***************************************** Constant definition End 
*****************************************/
-
-
-    /**************************************** Data initialization Begin 
****************************************/
-    //    sql """
-    //        DROP DATABASE IF EXISTS ${dbName};
-    //    """
-    //
-    //    sql """
-    //        CREATE DATABASE IF NOT EXISTS ${dbName};
-    //    """
-    //
-    //    sql """
-    //        DROP TABLE IF EXISTS ${fullTblName};
-    //    """
-    //
-    //    // Unsupported type: HLL, BITMAP, ARRAY, STRUCT, MAP, 
QUANTILE_STATE, JSONB
-    //    sql """
-    //        CREATE TABLE IF NOT EXISTS ${fullTblName} (
-    //            `c_id` LARGEINT NOT NULL,
-    //            `c_boolean` BOOLEAN,
-    //            `c_int` INT,
-    //            `c_float` FLOAT,
-    //            `c_double` DOUBLE,
-    //            `c_decimal` DECIMAL(6, 4),
-    //            `c_varchar` VARCHAR(10),
-    //            `c_datev2` DATEV2 NOT NULL
-    //        ) ENGINE=OLAP
-    //        DUPLICATE KEY(`c_id`)
-    //        PARTITION BY LIST(`c_datev2`)
-    //        (
-    //            PARTITION `p_20230501` VALUES IN ("2023-05-01"),
-    //            PARTITION `p_20230502` VALUES IN ("2023-05-02"),
-    //            PARTITION `p_20230503` VALUES IN ("2023-05-03"),
-    //            PARTITION `p_20230504` VALUES IN ("2023-05-04"),
-    //            PARTITION `p_20230505` VALUES IN ("2023-05-05")
-    //        )
-    //        DISTRIBUTED BY HASH(`c_id`) BUCKETS 1
-    //        PROPERTIES ("replication_num" = "1");
-    //    """
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, NULL, NULL, NULL, 
NULL, NULL, NULL, "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, 0, "11", 11.0, 
11.11, 11.1000, "aaa", "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, 1, "22", 22.0, 
22.22, 22.2000, "bbb", "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, 0, "33", 33.0, 
33.33, 33.3000, "ccc", "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, 1, "44", 44.0, 
44.44, 44.4000, "ddd", "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, 0, "55", 55.0, 
55.55, 55.5000, "eee", "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, 0, "11", 11.0, 
11.11, 11.1000, "aaa", "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, 1, "22", 22.0, 
22.22, 22.2000, "bbb", "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, 0, "33", 33.0, 
33.33, 33.3000, "ccc", "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, 1, "44", 44.0, 
44.44, 44.4000, "ddd", "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, 0, "55", 55.0, 
55.55, 55.5000, "eee", "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, 0, "11", 11.0, 
11.11, 11.1000, "aaa", "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, 1, "22", 22.0, 
22.22, 22.2000, "bbb", "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, 0, "33", 33.0, 
33.33, 33.3000, "ccc", "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, 1, "44", 44.0, 
44.44, 44.4000, "ddd", "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, 0, "55", 55.0, 
55.55, 55.5000, "eee", "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, 0, "11", 11.0, 
11.11, 11.1000, "aaa", "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, 1, "22", 22.0, 
22.22, 22.2000, "bbb", "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, 0, "33", 33.0, 
33.33, 33.3000, "ccc", "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, 1, "44", 44.0, 
44.44, 44.4000, "ddd", "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, 0, "55", 55.0, 
55.55, 55.5000, "eee", "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, 0, "11", 11.0, 
11.11, 11.1000, "aaa", "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, 1, "22", 22.0, 
22.22, 22.2000, "bbb", "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, 0, "33", 33.0, 
33.33, 33.3000, "ccc", "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, 1, "44", 44.0, 
44.44, 44.4000, "ddd", "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, 0, "55", 55.0, 
55.55, 55.5000, "eee", "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, 0, "11", 11.0, 
11.11, 11.1000, "aaa", "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, 1, "22", 22.0, 
22.22, 22.2000, "bbb", "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, 0, "33", 33.0, 
33.33, 33.3000, "ccc", "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, 1, "44", 44.0, 
44.44, 44.4000, "ddd", "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, 0, "55", 55.0, 
55.55, 55.5000, "eee", "2023-05-05");"""
-    //
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10001, 0, "11", 11.0, 
11.11, 11.1000, "aaa", "2023-05-01");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10002, 1, "22", 22.0, 
22.22, 22.2000, "bbb", "2023-05-02");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10003, 0, "33", 33.0, 
33.33, 33.3000, "ccc", "2023-05-03");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10004, 1, "44", 44.0, 
44.44, 44.4000, "ddd", "2023-05-04");"""
-    //    sql """ INSERT INTO ${fullTblName} VALUES (10005, 0, "55", 55.0, 
55.55, 55.5000, "eee", "2023-05-05");"""
-
-    //    order_qt_check_inserted_data """
-    //        SELECT * FROM ${fullTblName};
-    //    """
-    /***************************************** Data initialization End 
*****************************************/
-
-
-    /***************************************** Universal analysis Begin 
****************************************/
-    //    sql """
-    //        ANALYZE TABLE ${fullTblName} WITH sync;
-    //    """
-
-    // sql """
-    //     ANALYZE TABLE ${fullTblName} UPDATE HISTOGRAM WITH sync;
-    // """
-
-    // order_qt_check_column_stats """
-    //     SELECT $colStatisticsSchema FROM ${colStatisticsTblName}
-    //     WHERE `col_id` IN ($tblColumnNames);
-    // """
-
-    // order_qt_check_histogram_stats """
-    //     SELECT $colHistogramSchema  FROM ${colHistogramTblName}
-    //     WHERE `col_id` IN ($tblColumnNames);
-    // """
-    /*************************************** Universal analysis test End 
***************************************/
-
-
-    /******************************************* Clean up data Begin 
*******************************************/
-    // sql """
-    //     DROP DATABASE IF EXISTS ${dbName};
-    // """
-
-    // TODO At present, "DELETE FROM" may fail to delete, so comment it out 
temporarily
-    // sql """
-    //     DELETE FROM ${analysisJobsTblName} WHERE `tbl_name` = "$tblName";
-    // """
-    //
-    // sql """
-    //     DELETE FROM ${colStatisticsTblName} WHERE `col_id` IN 
($tblColumnNames);
-    // """
-    //
-    // sql """
-    //     DELETE FROM ${colHistogramTblName} WHERE `col_id` IN 
($tblColumnNames);
-    // """
-    /******************************************** Clean up data End 
********************************************/
+suite("test_analyze") {
+    String db = "regression_test_statistics"
+    String tbl = "analyzetestlimited_duplicate_all"
+
+    sql """
+          CREATE TABLE IF NOT EXISTS `${tbl}` (
+            `analyzetestlimitedk3` int(11) null comment "",
+            `analyzetestlimitedk0` boolean null comment "",
+            `analyzetestlimitedk1` tinyint(4) null comment "",
+            `analyzetestlimitedk2` smallint(6) null comment "",
+            `analyzetestlimitedk4` bigint(20) null comment "",
+            `analyzetestlimitedk5` decimalv3(9, 3) null comment "",
+            `analyzetestlimitedk6` char(36) null comment "",
+            `analyzetestlimitedk10` date null comment "",
+            `analyzetestlimitedk11` datetime null comment "",
+            `analyzetestlimitedk7` varchar(64) null comment "",
+            `analyzetestlimitedk8` double null comment "",
+            `analyzetestlimitedk9` float null comment "",
+            `analyzetestlimitedk12` string  null comment "",
+            `analyzetestlimitedk13` largeint(40)  null comment ""
+        ) engine=olap
+        DUPLICATE KEY(`analyzetestlimitedk3`)
+        DISTRIBUTED BY HASH(`analyzetestlimitedk3`) BUCKETS 5 
properties("replication_num" = "1")
+    """
+
+    sql """
+        INSERT INTO `${tbl}` VALUES 
(-2103297891,1,101,15248,4761818404925265645,939926.283,
+        'UTmCFKMbprf0zSVOIlBJRNOl3JcNBdOsnCDt','2022-09-28','2022-10-28 
01:56:56','tVvGDSrN6kyn',
+        
-954349107.187117,-40.46286,'g1ZP9nqVgaGKya3kPERdBofTWJQ4TIJEz972Xvw4hfPpTpWwlmondiLVTCyld7rSBlSWrE7NJRB0pvPGEFQKOx1s3',
+        '-1559301292834325905'),
+        
(-2094982029,0,-81,-14746,-2618177187906633064,121889.100,NULL,'2023-05-01','2022-11-25
 00:24:12',
+        
'36jVI0phYfhFucAOEASbh4OdvUYcI7QZFgQSveNyfGcRRUtQG9HGN1UcCmUH',-82250254.174239,NULL,
+        
'bTUHnMC4v7dI8U3TK0z4wZHdytjfHQfF1xKdYAVwPVNMT4fT4F92hj8ENQXmCkWtfp','6971810221218612372'),
+        
(-1840301109,1,NULL,NULL,7805768460922079440,546556.220,'wC7Pif9SJrg9b0wicGfPz2ezEmEKotmN6AMI',NULL,
+        '2023-05-20 18:13:14','NM5SLu62SGeuD',-1555800813.9748349,-11122.953,
+        
'NH97wIjXk7dspvvfUUKe41ZetUnDmqLxGg8UYXwOwK3Jlu7dxO2GE9UJjyKW0NBxqUk1DY','-5004534044262380098'),
+        
(-1819679967,0,10,NULL,-5772413527188525359,-532045.626,'kqMe4VYEZAmajLthCLRkl8StDQHKrDWz91AQ','2022-06-30',
+        '2023-02-22 
15:30:38','wAbeF3p84j5pFJTInQuKZOezFbsy8HIjmuUF',-1766437367.4377379,1791.4128,
+        
'6OWmBD04UeKt1xI2XnR8t1kPG7qEYrf4J8RkA8UMs4HF33Yl','-8433424551792664598'),
+        
(-1490846276,0,NULL,7744,6074522476276146996,594200.976,NULL,'2022-11-27','2023-03-11
 21:28:44',
+        
'yr8AuJLr2ud7DIwlt06cC7711UOsKslcDyySuqqfQE5X7Vjic6azHOrM6W',-715849856.288922,3762.217,
+        
'4UpWZJ0Twrefw0Tm0AxFS38V5','7406302706201801560'),(-1465848366,1,72,29170,-5585523608136628843,-34210.874,
+        'rMGygAWU91Wa3b5A7l1wheo6EF0o6zhw4YeE','2022-09-20','2023-06-11 
18:17:16','B6m9S9O2amsa4SXrEKK0ivJ2x9m1u8av',
+        
862085772.298349,-22304.209,'1','-3399178642401166400'),(-394034614,1,65,5393,-200651968801088119,NULL,
+        '9MapWX9pn8zes9Gey1lhRsH3ATyQPIysjQYi','2023-05-11','2022-07-02 
02:56:53','z5VWbuKr6HiK7yC7MRIoQGrb98VUS',
+        
1877828963.091433,-1204.1926,'fSDQqT38rkrJEi6fwc90rivgQcRPaW5V1aEmZpdSvUm','8882970420609470903'),
+        
(-287465855,0,-10,-32484,-5161845307234178602,748718.592,'n64TXbG25DQL5aw5oo9o9cowSjHCXry9HkId','2023-01-02',
+        '2022-11-17 
14:58:52','d523m4PwLdHZtPTqSoOBo5IGivCKe4A1Sc8SKCILFxgzYLe0',NULL,27979.855,
+        
'ps7qwcZjBjkGfcXYMw5HQMwnElzoHqinwk8vhQCbVoGBgfotc4oSkpD3tP34h4h0tTogDMwFu60iJm1bofUzyUQofTeRwZk8','4692206687866847780')
+    """
+
+    sql """
+        ANALYZE DATABASE ${db}
+    """
+
+    sql """
+        ANALYZE DATABASE ${db} WITH SYNC
+    """
+
+    sql """
+        SET enable_nereids_planner=true;
+        
+        """
+    sql """
+        SET enable_fallback_to_original_planner=false;
+        """
+    sql """
+        SET forbid_unknown_col_stats=true;
+        """
+
+    sql """
+        SELECT COUNT(*) FROM ${tbl}; 
+    """
+
+    sql """
+        DROP STATS ${tbl}(analyzetestlimitedk3)
+    """
+
+    exception = null
+
+    try {
+        sql """
+            SELECT COUNT(*) FROM ${tbl}; 
+        """
+    } catch (Exception e) {
+        exception = e
+    }
+
+    assert exception != null
+
+    exception = null
+
+    sql """
+        ANALYZE TABLE ${tbl} WITH SYNC
+    """
+
+    sql """
+        SELECT COUNT(*) FROM ${tbl}; 
+    """
+
+    sql """
+        DROP STATS ${tbl}
+    """
+
+    try {
+        sql """
+            SELECT COUNT(*) FROM ${tbl}; 
+        """
+    } catch (Exception e) {
+        exception = e
+    }
+
+    a_result_1 = sql """
+        ANALYZE DATABASE ${db} WITH SYNC WITH SAMPLE PERCENT 10
+    """
+
+    a_result_2 = sql """
+        ANALYZE DATABASE ${db} WITH SYNC WITH SAMPLE PERCENT 5
+    """
+
+    a_result_3 = sql """
+        ANALYZE DATABASE ${db} WITH SAMPLE PERCENT 5 WITH AUTO
+    """
+
+    show_result = sql """
+        SHOW ANALYZE
+    """
+
+    def contains_expected_table = {r ->
+        for(int i = 0; i < show_result.size; i++) {
+            if (show_result[i][3] == "${tbl}" ) {
+                return true
+            }
+        }
+        return false
+    }
+
+    def stats_job_removed = {r, id ->
+        for(int i = 0; i < r.size; i++) {
+            if (r[i][0] == id ) {
+                return false
+            }
+        }
+        return true
+    }
+
+    assert contains_expected_table(show_result)
+
+    sql """
+        DROP ANALYZE JOB ${a_result_3[0][4]}
+    """
+
+    show_result = sql """
+        SHOW ANALYZE
+    """
+
+    assert stats_job_removed(show_result, a_result_3[0][4])
+
+    sql """
+        ANALYZE DATABASE ${db} WITH SAMPLE ROWS 5 WITH PERIOD 100000
+    """
+
 }
 
diff --git a/regression-test/suites/statistics/manage_stats.groovy 
b/regression-test/suites/statistics/manage_stats.groovy
deleted file mode 100644
index 2fce6b0d08..0000000000
--- a/regression-test/suites/statistics/manage_stats.groovy
+++ /dev/null
@@ -1,271 +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.
-
-suite("test_manage_stats") {
-
-    // TODO At present, "DELETE FROM" may fail to delete, so comment it out 
temporarily, wait for the community to fix
-    // /**************************************** Constant definition Begin 
****************************************/
-    // def dbName = "test_manage_stats_db"
-    // def tblName = "test_manage_stats_tbl"
-    // def fullTblName = "${dbName}.${tblName}"
-    //
-    // def interDbName = "__internal_schema"
-    // def tblStatisticsTblName = "${interDbName}.table_statistics"
-    // def colHistogramTblName = "${interDbName}.histogram_statistics"
-    // def colStatisticsTblName = "${interDbName}.column_statistics"
-    // /***************************************** Constant definition End 
*****************************************/
-    //
-    //
-    // /**************************************** Data initialization Begin 
****************************************/
-    // sql """
-    //     DROP DATABASE IF EXISTS ${dbName};
-    // """
-    //
-    // sql """
-    //     CREATE DATABASE IF NOT EXISTS ${dbName};
-    // """
-    //
-    // sql """
-    //     DROP TABLE IF EXISTS ${fullTblName};
-    // """
-    //
-    // sql """
-    //     CREATE TABLE IF NOT EXISTS ${fullTblName} (
-    //         `c_id` LARGEINT NOT NULL,
-    //         `c_boolean` BOOLEAN,
-    //         `c_int` INT,
-    //         `c_float` FLOAT,
-    //         `c_double` DOUBLE,
-    //         `c_decimal` DECIMAL(6, 4),
-    //         `c_varchar` VARCHAR(10),
-    //         `c_datev2` DATEV2 NOT NULL
-    //     ) ENGINE=OLAP
-    //     DUPLICATE KEY(`c_id`)
-    //     PARTITION BY LIST(`c_datev2`)
-    //     (
-    //         PARTITION `p_20230501` VALUES IN ("2023-05-01"),
-    //         PARTITION `p_20230502` VALUES IN ("2023-05-02"),
-    //         PARTITION `p_20230503` VALUES IN ("2023-05-03"),
-    //         PARTITION `p_20230504` VALUES IN ("2023-05-04"),
-    //         PARTITION `p_20230505` VALUES IN ("2023-05-05")
-    //     )
-    //     DISTRIBUTED BY HASH(`c_id`) BUCKETS 1
-    //     PROPERTIES ("replication_num" = "1");
-    // """
-    // /***************************************** Data initialization End 
*****************************************/
-    //
-    // /************************************* Test1: Alter table stats Begin 
**************************************/
-    // final int tblRowCount = 12345678
-    //
-    // sql """
-    //     ALTER TABLE ${fullTblName} SET STATS ('row_count'='${tblRowCount}');
-    // """
-    //
-    // qt_sql_check_alter_tbl_stats """
-    //     SELECT `count` FROM ${tblStatisticsTblName} WHERE `count` = 
${tblRowCount};
-    // """
-    // /************************************** Test1: Alter table stats End 
***************************************/
-    //
-    //
-    // /***************************************** Obtain table ID Begin 
******************************************/
-    // def tblIdRes = sql """
-    //     SELECT `tbl_id` FROM ${tblStatisticsTblName} WHERE `count` = 
${tblRowCount};
-    // """
-    //
-    // assert (tblIdRes.size() == 1)
-    // assert (tblIdRes[0].size() == 1)
-    //
-    // long tableId = tblIdRes[0][0] as long
-    // /***************************************** Obtain table ID End 
*******************************************/
-    //
-    //
-    // /************************************* Test2 Show table stats Begin 
**************************************/
-    // sql """
-    //     DELETE FROM ${tblStatisticsTblName} WHERE tbl_id = ${tableId};
-    // """
-    //
-    // def tblCountSql = """
-    //     SELECT COUNT(*) FROM ${tblStatisticsTblName} WHERE tbl_id = 
${tableId};
-    // """
-    //
-    // assertTrue(isSqlValueEqualToTarget(tblCountSql, "0", 10000, 30))
-    //
-    // sql """
-    //     INSERT INTO ${tblStatisticsTblName} (id, catalog_id, db_id, tbl_id, 
idx_id, part_id, count,
-    //       last_analyze_time_in_ms, update_time)
-    //     VALUES (0, 0, 0, $tableId, -1, NULL, 10000, 1684655701003, 
"2023-06-23 22:30:29");
-    // """
-    //
-    // qt_sql_check_show_tbl_stats """
-    //     SHOW TABLE STATS ${fullTblName};
-    // """
-    // /*************************************** Test2 Show table stats End 
**************************************/
-    //
-    //
-    // /************************************ Test3: Alter column stats Begin 
************************************/
-    // final String colName = "c_varchar"
-    //
-    // sql """
-    //     ALTER TABLE ${fullTblName} MODIFY COLUMN `$colName`
-    //     SET STATS (
-    //         'row_count' = '87654321',
-    //         'ndv' = '54321',
-    //         'num_nulls' = '4321',
-    //         'min_value' = 'abc',
-    //         'max_value' = 'bcd',
-    //         'data_size'='655360000'
-    //     );
-    // """
-    //
-    // qt_sql_check_alter_col_stats """
-    //     SELECT `col_id`, `count`, `ndv`, `null_count`, `min`, `max`, 
`data_size_in_bytes`
-    //     FROM ${colStatisticsTblName} WHERE tbl_id = ${tableId} AND `col_id` 
= "${colName}";
-    // """
-    // /************************************* Test3: Alter column stats End 
*************************************/
-    //
-    //
-    // /************************************* Test4 Show column stats Begin 
*************************************/
-    // sql """
-    //     DELETE FROM ${colStatisticsTblName} WHERE tbl_id = ${tableId};
-    // """
-    //
-    // def colCountSql = """
-    //     SELECT COUNT(*) FROM ${colStatisticsTblName} WHERE tbl_id = 
${tableId};
-    // """
-    //
-    // assertTrue(isSqlValueEqualToTarget(colCountSql, "0", 10000, 30))
-    //
-    // sql """
-    //     INSERT INTO ${colStatisticsTblName} (id, catalog_id, db_id, tbl_id, 
idx_id, col_id, part_id, count,
-    //       ndv, null_count, min, max, data_size_in_bytes, update_time)
-    //     VALUES (0, 0, 0, $tableId, -1, "${colName}", NULL, 10000, 1000, 
100, "aaa", "sss", 1024, "2023-06-23 22:30:29");
-    // """
-    //
-    // qt_sql_check_show_col_stats """
-    //     SHOW COLUMN STATS ${fullTblName} ($colName);
-    // """
-    //
-    // sql """
-    //     INSERT INTO $colHistogramTblName (id, catalog_id, db_id, tbl_id, 
idx_id, col_id, sample_rate,
-    //       buckets, update_time)
-    //     VALUES (0, 0, 0, $tableId, -1, "${colName}", 0.8,
-    //       "[{\'lower\':\'2022-09-21 17:30:29\',\'upper\':\'2022-09-21 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':0,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-22 17:30:29\',\'upper\':\'2022-09-22 
22:30:29\',
-    //       \'count\':10,\'pre_sum\':9,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-23 17:30:29\',\'upper\':\'2022-09-23 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':19,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-24 17:30:29\',\'upper\':\'2022-09-24 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':28,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-25 17:30:29\',\'upper\':\'2022-09-25 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':37,\'ndv\':1}]",
-    //       "2023-06-23 22:30:29");
-    // """
-    //
-    // qt_sql_check_show_col_histogram """
-    //     SHOW COLUMN HISTOGRAM ${fullTblName} ($colName);
-    // """
-    // /*************************************** Test4 Show column stats End 
*************************************/
-    //
-    //
-    // /**************************************** Test5 Drop stats Begin 
*****************************************/
-    // sql """
-    //     INSERT INTO ${colStatisticsTblName} (id, catalog_id, db_id, tbl_id, 
idx_id, col_id, part_id, count,
-    //       ndv, null_count, min, max, data_size_in_bytes, update_time)
-    //     VALUES (0, 0, 0, $tableId, -1, "${colName}", NULL, 10000, 1000, 
100, "aaa", "sss", 1024, "2023-06-23 22:30:29");
-    // """
-    //
-    // sql """
-    //     INSERT INTO $colHistogramTblName (id, catalog_id, db_id, tbl_id, 
idx_id, col_id, sample_rate,
-    //       buckets, update_time)
-    //     VALUES (0, 0, 0, $tableId, -1, "${colName}", 0.8,
-    //       "[{\'lower\':\'2022-09-21 17:30:29\',\'upper\':\'2022-09-21 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':0,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-22 17:30:29\',\'upper\':\'2022-09-22 
22:30:29\',
-    //       \'count\':10,\'pre_sum\':9,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-23 17:30:29\',\'upper\':\'2022-09-23 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':19,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-24 17:30:29\',\'upper\':\'2022-09-24 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':28,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-25 17:30:29\',\'upper\':\'2022-09-25 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':37,\'ndv\':1}]",
-    //       "2023-06-23 22:30:29");
-    // """
-    //
-    // sql """
-    //     DROP STATS ${fullTblName} (${colName});
-    // """
-    //
-    // def colStatCountSql = """
-    //     SELECT COUNT(*) FROM $colStatisticsTblName WHERE tbl_id = 
${tableId} AND col_id = "${colName}";
-    // """
-    //
-    // def colHistCountSql = """
-    //     SELECT COUNT(*) FROM $colHistogramTblName WHERE tbl_id = ${tableId} 
AND col_id = "${colName}";
-    // """
-    //
-    // assertTrue(isSqlValueEqualToTarget(colStatCountSql, "0", 10000, 30))
-    //
-    // assertTrue(isSqlValueEqualToTarget(colHistCountSql, "0", 10000, 30))
-    //
-    // sql """
-    //     INSERT INTO ${colStatisticsTblName} (id, catalog_id, db_id, tbl_id, 
idx_id, col_id, part_id, count,
-    //       ndv, null_count, min, max, data_size_in_bytes, update_time)
-    //     VALUES (0, 0, 0, $tableId, -1, "${colName}", NULL, 10000, 1000, 
100, "aaa", "sss", 1024, "2023-06-23 22:30:29");
-    // """
-    //
-    // sql """
-    //     INSERT INTO $colHistogramTblName (id, catalog_id, db_id, tbl_id, 
idx_id, col_id, sample_rate,
-    //       buckets, update_time)
-    //     VALUES (0, 0, 0, $tableId, -1, "${colName}", 0.8,
-    //       "[{\'lower\':\'2022-09-21 17:30:29\',\'upper\':\'2022-09-21 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':0,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-22 17:30:29\',\'upper\':\'2022-09-22 
22:30:29\',
-    //       \'count\':10,\'pre_sum\':9,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-23 17:30:29\',\'upper\':\'2022-09-23 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':19,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-24 17:30:29\',\'upper\':\'2022-09-24 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':28,\'ndv\':1},'
-    //       {\'lower\':\'2022-09-25 17:30:29\',\'upper\':\'2022-09-25 
22:30:29\',
-    //       \'count\':9,\'pre_sum\':37,\'ndv\':1}]",
-    //       "2023-06-23 22:30:29");
-    // """
-    //
-    // sql """
-    //     DROP DATABASE IF EXISTS ${dbName};
-    // """
-    //
-    // sql """
-    //     DROP EXPIRED STATS;
-    // """
-    //
-    // def statCountSql = """
-    //     SELECT COUNT(*) FROM $colStatisticsTblName WHERE tbl_id = 
${tableId};
-    // """
-    //
-    // def histCountSql = """
-    //     SELECT COUNT(*) FROM $colHistogramTblName WHERE tbl_id = ${tableId};
-    // """
-    //
-    // assertTrue(isSqlValueEqualToTarget(statCountSql, "0", 10000, 30))
-    //
-    // // TODO drop expired histogram
-    // sql """DELETE FROM $colHistogramTblName WHERE tbl_id = ${tableId}"""
-    // // assertTrue(isSqlValueEqualToTarget(histCountSql, "0", 10000, 30))
-    // /***************************************** Test5 Drop stats End 
*****************************************/
-}
-
diff --git a/regression-test/suites/statistics/test_ddl.groovy 
b/regression-test/suites/statistics/test_ddl.groovy
new file mode 100644
index 0000000000..06e1c72e16
--- /dev/null
+++ b/regression-test/suites/statistics/test_ddl.groovy
@@ -0,0 +1,80 @@
+// 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.
+
+suite("test_ddl") {
+    sql """
+        INSERT INTO `__internal_schema`.`column_statistics` VALUES 
('10143--1-cd_credit_rating','0','10141','10143','-1','cd_credit_rating',NULL,1920800,4,0,'Good','Unknown',0,'2023-06-15
 
19:50:43'),('10143--1-cd_demo_sk-10142','0','10141','10143','-1','cd_demo_sk','10142',1920800,1916366,0,'1','1920800',0,'2023-06-15
 
19:50:42'),('10143--1-cd_dep_employed_count','0','10141','10143','-1','cd_dep_employed_count',NULL,1920800,7,0,'0','6',0,'2023-06-15
 19:50:43'),('10143--1-cd_dep_employed_c [...]
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS `agg_all_for_analyze_test` (
+            `agg_all_for_analyze_test_k2` smallint(6) null comment "",
+            `agg_all_for_analyze_test_k0` boolean null comment "",
+            `agg_all_for_analyze_test_k1` tinyint(4) null comment "",
+            `agg_all_for_analyze_test_k3` int(11) null comment "",
+            `agg_all_for_analyze_test_k4` bigint(20) null comment "",
+            `agg_all_for_analyze_test_k5` decimalv3(9, 3) null comment "",
+            `agg_all_for_analyze_test_k6` char(36) null comment "",
+            `agg_all_for_analyze_test_k10` date null comment "",
+            `agg_all_for_analyze_test_k11` datetime null comment "",
+            `agg_all_for_analyze_test_k7` varchar(64) null comment "",
+            `agg_all_for_analyze_test_k8` double max null comment "",
+            `agg_all_for_analyze_test_k9` float sum null comment "",
+            `agg_all_for_analyze_test_k12` string replace null comment "",
+            `agg_all_for_analyze_test_k13` largeint(40) replace null comment ""
+        ) engine=olap
+        DISTRIBUTED BY HASH(`agg_all_for_analyze_test_k2`) BUCKETS 5 
properties("replication_num" = "1");
+    """
+
+    sql """
+        INSERT INTO `agg_all_for_analyze_test` VALUES 
(-24673,0,-127,-1939606877,-105278987563368327,-257119.385,'bA5rPeM244SovDhOOQ02CmXeM69uhJ8GSHtU','2022-09-28','2022-08-23
 
01:34:09','wrHimKN3w24QvUiplB9HFWdeCCeX0bQbbFima85zhb1kQ0s6lP6ctie2oGuKF',-4060736.642127,NULL,'22bCQDgO6A0FJB22Q9bASB8cHnYqHeKKGsa1e','-6225805734985728798'),(-22254,0,28,702265972,-6301108547516189202,-667430.114,'M0sReWtDXk7zt7AiDCzuqciSo0JuZzNI3Kez','2022-11-24','2022-11-29
 22:52:56','gxsUl9OwrHYuy8Ih0A6XShMYk [...]
+    """
+
+    sql """
+        INSERT INTO __internal_schema.column_statistics    SELECT id, 
catalog_id, db_id, tbl_id, idx_id, col_id,
+        part_id, row_count,         ndv, null_count, min, max, data_size, 
update_time
+    FROM 
+     (SELECT CONCAT(18570, '-', -1, '-', 'k13') AS id,          0 AS 
catalog_id,          13003 AS db_id,          
+     18570 AS tbl_id,          -1 AS idx_id,          
+     'k13' AS col_id,          NULL AS part_id,          SUM(count) AS 
row_count, 
+         SUM(null_count) AS null_count,          
+         MIN(CAST(min AS LARGEINT)) AS min,          MAX(CAST(max AS 
LARGEINT)) AS max,          
+         SUM(data_size_in_bytes) AS data_size,          NOW() AS update_time
+     FROM __internal_schema.column_statistics     WHERE 
__internal_schema.column_statistics.db_id = '13003' AND 
+     __internal_schema.column_statistics.tbl_id='18570' AND      
__internal_schema.column_statistics.col_id='k13' AND 
+     __internal_schema.column_statistics.idx_id='-1' AND      
__internal_schema.column_statistics.part_id IS NOT NULL     ) t1, 
+     (SELECT NDV(`agg_all_for_analyze_test_k13`) AS ndv      FROM 
`agg_all_for_analyze_test`) t2 
+    """
+
+    // Delete always timeout when running p0 test
+   // sql """
+   //     DELETE FROM __internal_schema.column_statistics WHERE col_id = 
'agg_all_for_analyze_test_k2'
+   // """
+
+   // sql """
+   //     DELETE FROM __internal_schema.column_statistics WHERE col_id = 
'agg_all_for_analyze_test_k3'
+   // """
+
+   // sql """
+   //     DELETE FROM __internal_schema.column_statistics WHERE col_id = 
'agg_all_for_analyze_test_k4'
+   // """
+
+   // sql """
+   //     DELETE FROM __internal_schema.column_statistics WHERE col_id = 
'agg_all_for_analyze_test_k0'
+   // """
+}
+


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


Reply via email to