You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "weizhengte (via GitHub)" <gi...@apache.org> on 2023/04/23 12:28:52 UTC

[GitHub] [doris] weizhengte opened a new pull request, #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

weizhengte opened a new pull request, #18971:
URL: https://github.com/apache/doris/pull/18971

   # Proposed changes
   
   This pr mainly optimizes the following items:
   - the collection of statistics: clear up invalid historical statistics before collecting them, so as not to affect the final table statistics.
   - the incremental collection of statistics: in the case of incremental collection, only the corresponding partition statistics need to be collected.
   
   TODO: Supports incremental collection of materialized view statistics.
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] github-actions[bot] commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1522154393

   PR approved by anyone and no changes requested.


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1519207594

   run p0


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1521071614

   run p1


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] morrySnow merged pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow merged PR #18971:
URL: https://github.com/apache/doris/pull/18971


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1522704885

   run p0


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] Kikyou1997 commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "Kikyou1997 (via GitHub)" <gi...@apache.org>.
Kikyou1997 commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1176160526


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java:
##########
@@ -100,6 +101,11 @@ public class StatisticsRepository {
                     + " ORDER BY update_time "
                     + "LIMIT ${limit} OFFSET ${offset}";
 
+    private static final String FETCH_STATS_PART_ID = "SELECT DISTINCT col_id, part_id FROM "

Review Comment:
   I think `distinct` here is useless, since every part is unique



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1522563041

   run p0


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1521210839

   run p1


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] hello-stephen commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1519060594

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 34.14 seconds
    stream load tsv:          427 seconds loaded 74807831229 Bytes, about 167 MB/s
    stream load json:         21 seconds loaded 2358488459 Bytes, about 107 MB/s
    stream load orc:          59 seconds loaded 1101869774 Bytes, about 17 MB/s
    stream load parquet:          31 seconds loaded 861443392 Bytes, about 26 MB/s
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230423125156_clickbench_pr_133442.html


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] Kikyou1997 commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "Kikyou1997 (via GitHub)" <gi...@apache.org>.
Kikyou1997 commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1176146017


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java:
##########
@@ -109,6 +122,80 @@ public void createAnalysisJob(AnalyzeStmt stmt) throws DdlException {
         analysisTaskInfos.values().forEach(taskScheduler::schedule);
     }
 
+    /**
+     * Gets the partitions for which statistics are to be collected. First verify that
+     * there are partitions that have been deleted but have historical statistics(invalid statistics),
+     * if there are these partitions, we need to delete them to avoid errors in summary table level statistics.
+     * Then get the partitions for which statistics need to be collected based on collection mode (incremental/full).
+     * <p>
+     * note:
+     * If there is no invalid statistics, it does not need to collect/update
+     * statistics if the following conditions are met:
+     * - in full collection mode, the partitioned table does not have partitions
+     * - in incremental collection mode, partition statistics already exist
+     * <p>
+     * TODO Supports incremental collection of statistics from materialized views
+     */
+    private Map<String, Set<String>> validateAndGetPartitions(AnalyzeStmt stmt) throws DdlException {
+        TableIf table = stmt.getTable();
+        long tableId = table.getId();
+        Set<String> columnNames = stmt.getColumnNames();
+        Set<String> partitionNames = table.getPartitionNames();
+
+        Map<String, Set<String>> columnToPartitions = Maps.newHashMap();
+        columnNames.forEach(column -> columnToPartitions
+                .computeIfAbsent(column, partitions -> new HashSet<>()).addAll(partitionNames));

Review Comment:
   Seems `computeIfAbsent` here is redundant, since `columnToPartitions` is always empty when invoke `columnToPartitions`, thought the overhead is not too much



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1522687894

   run p0


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] Kikyou1997 commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "Kikyou1997 (via GitHub)" <gi...@apache.org>.
Kikyou1997 commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1176170741


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java:
##########
@@ -173,14 +179,22 @@ private static String constructId(Object... params) {
     }
 
     public static void dropStatistics(long tblId, Set<String> colNames) throws DdlException {
-        dropStatistics(tblId, colNames, StatisticConstants.STATISTIC_TBL_NAME);
-        dropStatistics(tblId, colNames, StatisticConstants.HISTOGRAM_TBL_NAME);
+        dropStatistics(tblId, Collections.emptySet(), colNames, StatisticConstants.STATISTIC_TBL_NAME);
+        dropStatistics(tblId, Collections.emptySet(), colNames, StatisticConstants.HISTOGRAM_TBL_NAME);
     }
 
-    public static void dropStatistics(long tblId, Set<String> colNames, String statsTblName) throws DdlException {
+    public static void dropStatistics(long tblId, Set<Long> partNames, Set<String> colNames,
+            String statsTblName) throws DdlException {
         Map<String, String> params = new HashMap<>();
-        String right = colNames.stream().map(s -> "'" + s + "'").collect(Collectors.joining(","));
-        String inPredicate = String.format("tbl_id = %s AND %s IN (%s)", tblId, "col_id", right);
+        String inPredicate = String.format("tbl_id = %s", tblId);
+        if (!colNames.isEmpty()) {
+            String right = StatisticsUtil.joinElementsToString(colNames, "', '");
+            inPredicate += String.format(" AND col_id IN ('%s')", right);

Review Comment:
   Since part_id is unique, do we need col_id and tbl_id as condition?



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1176223343


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java:
##########
@@ -100,6 +101,11 @@ public class StatisticsRepository {
                     + " ORDER BY update_time "
                     + "LIMIT ${limit} OFFSET ${offset}";
 
+    private static final String FETCH_STATS_PART_ID = "SELECT DISTINCT col_id, part_id FROM "

Review Comment:
   thx, you're right



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1522928965

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] Kikyou1997 commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "Kikyou1997 (via GitHub)" <gi...@apache.org>.
Kikyou1997 commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1176160526


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java:
##########
@@ -100,6 +101,11 @@ public class StatisticsRepository {
                     + " ORDER BY update_time "
                     + "LIMIT ${limit} OFFSET ${offset}";
 
+    private static final String FETCH_STATS_PART_ID = "SELECT DISTINCT col_id, part_id FROM "

Review Comment:
   I think `distinct` here is useless, since every `part_id` is unique



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1521496285

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1520406539

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1519412221

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1176279151


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java:
##########
@@ -173,14 +179,22 @@ private static String constructId(Object... params) {
     }
 
     public static void dropStatistics(long tblId, Set<String> colNames) throws DdlException {
-        dropStatistics(tblId, colNames, StatisticConstants.STATISTIC_TBL_NAME);
-        dropStatistics(tblId, colNames, StatisticConstants.HISTOGRAM_TBL_NAME);
+        dropStatistics(tblId, Collections.emptySet(), colNames, StatisticConstants.STATISTIC_TBL_NAME);
+        dropStatistics(tblId, Collections.emptySet(), colNames, StatisticConstants.HISTOGRAM_TBL_NAME);
     }
 
-    public static void dropStatistics(long tblId, Set<String> colNames, String statsTblName) throws DdlException {
+    public static void dropStatistics(long tblId, Set<Long> partNames, Set<String> colNames,
+            String statsTblName) throws DdlException {
         Map<String, String> params = new HashMap<>();
-        String right = colNames.stream().map(s -> "'" + s + "'").collect(Collectors.joining(","));
-        String inPredicate = String.format("tbl_id = %s AND %s IN (%s)", tblId, "col_id", right);
+        String inPredicate = String.format("tbl_id = %s", tblId);
+        if (!colNames.isEmpty()) {
+            String right = StatisticsUtil.joinElementsToString(colNames, "', '");
+            inPredicate += String.format(" AND col_id IN ('%s')", right);

Review Comment:
   Yes, the col_id and tbl_id conditions can be unnecessary



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1521747759

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1177849701


##########
regression-test/suites/statistics/incremental_stats_test.groovy:
##########
@@ -0,0 +1,292 @@
+// 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_incremental_stats") {
+    def dbName = "test_incremental_stats"
+    def tblName = "${dbName}.example_tbl"
+
+    def colStatisticsTblName = "__internal_schema.column_statistics"
+    def analysisJobsTblName = "__internal_schema.analysis_jobs"
+
+    def columnNames = """
+        (
+            `t_1682176142000_user_id`, `t_1682176142000_date`, 
+            `t_1682176142000_city`, `t_1682176142000_age`, `t_1682176142000_sex`, 
+            `t_1682176142000_last_visit_date`, `t_1682176142000_cost`, 
+            `t_1682176142000_max_dwell_time`, `t_1682176142000_min_dwell_time`
+        )
+    """
+
+    def columnNameValues = """
+        (
+            't_1682176142000_user_id', 't_1682176142000_date', 't_1682176142000_city', 
+            't_1682176142000_age', 't_1682176142000_sex', 't_1682176142000_last_visit_date', 
+            't_1682176142000_cost', 't_1682176142000_max_dwell_time', 't_1682176142000_min_dwell_time'
+        ) 
+    """
+
+    def query_col_statistics_with_order_sql = """
+        SELECT 
+            count, 
+            ndv, 
+            null_count, 
+            min, 
+            max, 
+            data_size_in_bytes 
+        FROM 
+            ${colStatisticsTblName} 
+        WHERE 
+            col_id IN ${columnNameValues}
+        ORDER BY 
+            col_id,
+            min, 
+            max,
+            count, 
+            ndv, 
+            null_count, 
+            data_size_in_bytes;
+    """
+
+    def query_analysis_jobs_count_sql = """
+        SELECT 
+            COUNT(*) 
+        FROM 
+            ${analysisJobsTblName} 
+        WHERE 
+            col_name IN ${columnNameValues};
+    """
+
+    sql """
+        DROP DATABASE IF EXISTS ${dbName};
+    """
+
+    sql """
+        CREATE DATABASE IF NOT EXISTS ${dbName};
+    """
+
+    sql """
+        DROP TABLE IF EXISTS ${tblName};
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tblName} (
+            `t_1682176142000_user_id` LARGEINT NOT NULL,
+            `t_1682176142000_date` DATE NOT NULL,
+            `t_1682176142000_city` VARCHAR(20),
+            `t_1682176142000_age` SMALLINT,
+            `t_1682176142000_sex` TINYINT,
+            `t_1682176142000_last_visit_date` DATETIME REPLACE,
+            `t_1682176142000_cost` BIGINT SUM,
+            `t_1682176142000_max_dwell_time` INT MAX,
+            `t_1682176142000_min_dwell_time` INT MIN
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`t_1682176142000_user_id`, `t_1682176142000_date`,
+         `t_1682176142000_city`, `t_1682176142000_age`, `t_1682176142000_sex`)
+        PARTITION BY LIST(`t_1682176142000_date`)
+        (
+            PARTITION `p_201701` VALUES IN ("2017-10-01"),
+            PARTITION `p_201702` VALUES IN ("2017-10-02"),
+            PARTITION `p_201703` VALUES IN ("2017-10-03")
+        )
+        DISTRIBUTED BY HASH(`t_1682176142000_user_id`) BUCKETS 1
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+    """
+
+    sql """
+        INSERT INTO ${tblName} ${columnNames}
+        VALUES (10000, "2017-10-01", "北京", 20, 0, "2017-10-01 07:00:00", 15, 2, 2),
+            (10000, "2017-10-01", "北京", 20, 0, "2017-10-01 06:00:00", 20, 10, 10),
+            (10001, "2017-10-01", "北京", 30, 1, "2017-10-01 17:05:45", 2, 22, 22),
+            (10002, "2017-10-02", "上海", 20, 1, "2017-10-02 12:59:12", 200, 5, 5),
+            (10003, "2017-10-02", "广州", 32, 0, "2017-10-02 11:20:00", 30, 11, 11),
+            (10004, "2017-10-01", "深圳", 35, 0, "2017-10-01 10:00:15", 100, 3, 3),
+            (10004, "2017-10-03", "深圳", 35, 0, "2017-10-03 10:20:22", 11, 6, 6);
+    """
+
+    sql """  
+        DELETE FROM __internal_schema.column_statistics
+        WHERE col_id IN ${columnNameValues}  
+        """
+
+    // TODO delete by database name and table name
+    sql """
+        DELETE FROM __internal_schema.analysis_jobs WHERE job_id IS NOT NULL;
+        """
+
+    // 1. Firstly do a full collection of statistics
+    sql """
+        ANALYZE TABLE ${tblName} ${columnNames};
+    """
+
+     Thread.sleep(5000)
+
+    // Collecting all 9 columns will generate 9 tasks (total tasks: 9)
+    qt_sql query_analysis_jobs_count_sql

Review Comment:
   yeah, this is really not a good way, I have changed(not use sleep way). 
   
   > The main reason is that the saving statistics synchronization task info was canceled earlier. The incremental collection function may not be stable at the moment, and we still need to save the synchronization task info to ensure that the incremental collection of statistics is tested, so I changed it back.



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1520046090

   run p0


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1177850453


##########
regression-test/suites/statistics/incremental_stats_test.groovy:
##########
@@ -0,0 +1,292 @@
+// 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_incremental_stats") {
+    def dbName = "test_incremental_stats"
+    def tblName = "${dbName}.example_tbl"
+
+    def colStatisticsTblName = "__internal_schema.column_statistics"
+    def analysisJobsTblName = "__internal_schema.analysis_jobs"
+
+    def columnNames = """
+        (
+            `t_1682176142000_user_id`, `t_1682176142000_date`, 
+            `t_1682176142000_city`, `t_1682176142000_age`, `t_1682176142000_sex`, 
+            `t_1682176142000_last_visit_date`, `t_1682176142000_cost`, 
+            `t_1682176142000_max_dwell_time`, `t_1682176142000_min_dwell_time`
+        )
+    """
+
+    def columnNameValues = """
+        (
+            't_1682176142000_user_id', 't_1682176142000_date', 't_1682176142000_city', 
+            't_1682176142000_age', 't_1682176142000_sex', 't_1682176142000_last_visit_date', 
+            't_1682176142000_cost', 't_1682176142000_max_dwell_time', 't_1682176142000_min_dwell_time'
+        ) 
+    """
+
+    def query_col_statistics_with_order_sql = """
+        SELECT 
+            count, 
+            ndv, 
+            null_count, 
+            min, 
+            max, 
+            data_size_in_bytes 
+        FROM 
+            ${colStatisticsTblName} 
+        WHERE 
+            col_id IN ${columnNameValues}
+        ORDER BY 
+            col_id,
+            min, 
+            max,
+            count, 
+            ndv, 
+            null_count, 
+            data_size_in_bytes;
+    """
+
+    def query_analysis_jobs_count_sql = """
+        SELECT 
+            COUNT(*) 
+        FROM 
+            ${analysisJobsTblName} 
+        WHERE 
+            col_name IN ${columnNameValues};
+    """
+
+    sql """
+        DROP DATABASE IF EXISTS ${dbName};
+    """
+
+    sql """
+        CREATE DATABASE IF NOT EXISTS ${dbName};
+    """
+
+    sql """
+        DROP TABLE IF EXISTS ${tblName};
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tblName} (
+            `t_1682176142000_user_id` LARGEINT NOT NULL,
+            `t_1682176142000_date` DATE NOT NULL,
+            `t_1682176142000_city` VARCHAR(20),
+            `t_1682176142000_age` SMALLINT,
+            `t_1682176142000_sex` TINYINT,
+            `t_1682176142000_last_visit_date` DATETIME REPLACE,
+            `t_1682176142000_cost` BIGINT SUM,
+            `t_1682176142000_max_dwell_time` INT MAX,
+            `t_1682176142000_min_dwell_time` INT MIN
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`t_1682176142000_user_id`, `t_1682176142000_date`,
+         `t_1682176142000_city`, `t_1682176142000_age`, `t_1682176142000_sex`)
+        PARTITION BY LIST(`t_1682176142000_date`)
+        (
+            PARTITION `p_201701` VALUES IN ("2017-10-01"),
+            PARTITION `p_201702` VALUES IN ("2017-10-02"),
+            PARTITION `p_201703` VALUES IN ("2017-10-03")
+        )
+        DISTRIBUTED BY HASH(`t_1682176142000_user_id`) BUCKETS 1
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+    """
+
+    sql """
+        INSERT INTO ${tblName} ${columnNames}
+        VALUES (10000, "2017-10-01", "北京", 20, 0, "2017-10-01 07:00:00", 15, 2, 2),
+            (10000, "2017-10-01", "北京", 20, 0, "2017-10-01 06:00:00", 20, 10, 10),
+            (10001, "2017-10-01", "北京", 30, 1, "2017-10-01 17:05:45", 2, 22, 22),
+            (10002, "2017-10-02", "上海", 20, 1, "2017-10-02 12:59:12", 200, 5, 5),
+            (10003, "2017-10-02", "广州", 32, 0, "2017-10-02 11:20:00", 30, 11, 11),
+            (10004, "2017-10-01", "深圳", 35, 0, "2017-10-01 10:00:15", 100, 3, 3),
+            (10004, "2017-10-03", "深圳", 35, 0, "2017-10-03 10:20:22", 11, 6, 6);
+    """
+
+    sql """  
+        DELETE FROM __internal_schema.column_statistics
+        WHERE col_id IN ${columnNameValues}  
+        """
+
+    // TODO delete by database name and table name
+    sql """
+        DELETE FROM __internal_schema.analysis_jobs WHERE job_id IS NOT NULL;
+        """
+
+    // 1. Firstly do a full collection of statistics
+    sql """
+        ANALYZE TABLE ${tblName} ${columnNames};
+    """
+
+     Thread.sleep(5000)
+
+    // Collecting all 9 columns will generate 9 tasks (total tasks: 9)
+    qt_sql query_analysis_jobs_count_sql
+
+    // Check the collected statistics
+    qt_sql query_col_statistics_with_order_sql
+
+    // Incrementally collect statistics
+    sql """
+        ANALYZE TABLE ${tblName} ${columnNames} WITH incremental;
+    """
+
+     Thread.sleep(5000)
+
+    // The table data has not changed, and no new tasks should be generated (total tasks:  9)
+    qt_sql query_analysis_jobs_count_sql
+
+    // Statistics won't change either
+    qt_sql query_col_statistics_with_order_sql

Review Comment:
   same as above



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1523548483

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1524288865

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] englefly commented on a diff in pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "englefly (via GitHub)" <gi...@apache.org>.
englefly commented on code in PR #18971:
URL: https://github.com/apache/doris/pull/18971#discussion_r1177396388


##########
regression-test/suites/statistics/incremental_stats_test.groovy:
##########
@@ -0,0 +1,292 @@
+// 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_incremental_stats") {
+    def dbName = "test_incremental_stats"
+    def tblName = "${dbName}.example_tbl"
+
+    def colStatisticsTblName = "__internal_schema.column_statistics"
+    def analysisJobsTblName = "__internal_schema.analysis_jobs"
+
+    def columnNames = """
+        (
+            `t_1682176142000_user_id`, `t_1682176142000_date`, 
+            `t_1682176142000_city`, `t_1682176142000_age`, `t_1682176142000_sex`, 
+            `t_1682176142000_last_visit_date`, `t_1682176142000_cost`, 
+            `t_1682176142000_max_dwell_time`, `t_1682176142000_min_dwell_time`
+        )
+    """
+
+    def columnNameValues = """
+        (
+            't_1682176142000_user_id', 't_1682176142000_date', 't_1682176142000_city', 
+            't_1682176142000_age', 't_1682176142000_sex', 't_1682176142000_last_visit_date', 
+            't_1682176142000_cost', 't_1682176142000_max_dwell_time', 't_1682176142000_min_dwell_time'
+        ) 
+    """
+
+    def query_col_statistics_with_order_sql = """
+        SELECT 
+            count, 
+            ndv, 
+            null_count, 
+            min, 
+            max, 
+            data_size_in_bytes 
+        FROM 
+            ${colStatisticsTblName} 
+        WHERE 
+            col_id IN ${columnNameValues}
+        ORDER BY 
+            col_id,
+            min, 
+            max,
+            count, 
+            ndv, 
+            null_count, 
+            data_size_in_bytes;
+    """
+
+    def query_analysis_jobs_count_sql = """
+        SELECT 
+            COUNT(*) 
+        FROM 
+            ${analysisJobsTblName} 
+        WHERE 
+            col_name IN ${columnNameValues};
+    """
+
+    sql """
+        DROP DATABASE IF EXISTS ${dbName};
+    """
+
+    sql """
+        CREATE DATABASE IF NOT EXISTS ${dbName};
+    """
+
+    sql """
+        DROP TABLE IF EXISTS ${tblName};
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tblName} (
+            `t_1682176142000_user_id` LARGEINT NOT NULL,
+            `t_1682176142000_date` DATE NOT NULL,
+            `t_1682176142000_city` VARCHAR(20),
+            `t_1682176142000_age` SMALLINT,
+            `t_1682176142000_sex` TINYINT,
+            `t_1682176142000_last_visit_date` DATETIME REPLACE,
+            `t_1682176142000_cost` BIGINT SUM,
+            `t_1682176142000_max_dwell_time` INT MAX,
+            `t_1682176142000_min_dwell_time` INT MIN
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`t_1682176142000_user_id`, `t_1682176142000_date`,
+         `t_1682176142000_city`, `t_1682176142000_age`, `t_1682176142000_sex`)
+        PARTITION BY LIST(`t_1682176142000_date`)
+        (
+            PARTITION `p_201701` VALUES IN ("2017-10-01"),
+            PARTITION `p_201702` VALUES IN ("2017-10-02"),
+            PARTITION `p_201703` VALUES IN ("2017-10-03")
+        )
+        DISTRIBUTED BY HASH(`t_1682176142000_user_id`) BUCKETS 1
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+    """
+
+    sql """
+        INSERT INTO ${tblName} ${columnNames}
+        VALUES (10000, "2017-10-01", "北京", 20, 0, "2017-10-01 07:00:00", 15, 2, 2),
+            (10000, "2017-10-01", "北京", 20, 0, "2017-10-01 06:00:00", 20, 10, 10),
+            (10001, "2017-10-01", "北京", 30, 1, "2017-10-01 17:05:45", 2, 22, 22),
+            (10002, "2017-10-02", "上海", 20, 1, "2017-10-02 12:59:12", 200, 5, 5),
+            (10003, "2017-10-02", "广州", 32, 0, "2017-10-02 11:20:00", 30, 11, 11),
+            (10004, "2017-10-01", "深圳", 35, 0, "2017-10-01 10:00:15", 100, 3, 3),
+            (10004, "2017-10-03", "深圳", 35, 0, "2017-10-03 10:20:22", 11, 6, 6);
+    """
+
+    sql """  
+        DELETE FROM __internal_schema.column_statistics
+        WHERE col_id IN ${columnNameValues}  
+        """
+
+    // TODO delete by database name and table name
+    sql """
+        DELETE FROM __internal_schema.analysis_jobs WHERE job_id IS NOT NULL;
+        """
+
+    // 1. Firstly do a full collection of statistics
+    sql """
+        ANALYZE TABLE ${tblName} ${columnNames};
+    """
+
+     Thread.sleep(5000)
+
+    // Collecting all 9 columns will generate 9 tasks (total tasks: 9)
+    qt_sql query_analysis_jobs_count_sql
+
+    // Check the collected statistics
+    qt_sql query_col_statistics_with_order_sql
+
+    // Incrementally collect statistics
+    sql """
+        ANALYZE TABLE ${tblName} ${columnNames} WITH incremental;
+    """
+
+     Thread.sleep(5000)
+
+    // The table data has not changed, and no new tasks should be generated (total tasks:  9)
+    qt_sql query_analysis_jobs_count_sql
+
+    // Statistics won't change either
+    qt_sql query_col_statistics_with_order_sql

Review Comment:
   this check may fail. sleep(5000) can not guarantee this.



##########
regression-test/suites/statistics/incremental_stats_test.groovy:
##########
@@ -0,0 +1,292 @@
+// 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_incremental_stats") {
+    def dbName = "test_incremental_stats"
+    def tblName = "${dbName}.example_tbl"
+
+    def colStatisticsTblName = "__internal_schema.column_statistics"
+    def analysisJobsTblName = "__internal_schema.analysis_jobs"
+
+    def columnNames = """
+        (
+            `t_1682176142000_user_id`, `t_1682176142000_date`, 
+            `t_1682176142000_city`, `t_1682176142000_age`, `t_1682176142000_sex`, 
+            `t_1682176142000_last_visit_date`, `t_1682176142000_cost`, 
+            `t_1682176142000_max_dwell_time`, `t_1682176142000_min_dwell_time`
+        )
+    """
+
+    def columnNameValues = """
+        (
+            't_1682176142000_user_id', 't_1682176142000_date', 't_1682176142000_city', 
+            't_1682176142000_age', 't_1682176142000_sex', 't_1682176142000_last_visit_date', 
+            't_1682176142000_cost', 't_1682176142000_max_dwell_time', 't_1682176142000_min_dwell_time'
+        ) 
+    """
+
+    def query_col_statistics_with_order_sql = """
+        SELECT 
+            count, 
+            ndv, 
+            null_count, 
+            min, 
+            max, 
+            data_size_in_bytes 
+        FROM 
+            ${colStatisticsTblName} 
+        WHERE 
+            col_id IN ${columnNameValues}
+        ORDER BY 
+            col_id,
+            min, 
+            max,
+            count, 
+            ndv, 
+            null_count, 
+            data_size_in_bytes;
+    """
+
+    def query_analysis_jobs_count_sql = """
+        SELECT 
+            COUNT(*) 
+        FROM 
+            ${analysisJobsTblName} 
+        WHERE 
+            col_name IN ${columnNameValues};
+    """
+
+    sql """
+        DROP DATABASE IF EXISTS ${dbName};
+    """
+
+    sql """
+        CREATE DATABASE IF NOT EXISTS ${dbName};
+    """
+
+    sql """
+        DROP TABLE IF EXISTS ${tblName};
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tblName} (
+            `t_1682176142000_user_id` LARGEINT NOT NULL,
+            `t_1682176142000_date` DATE NOT NULL,
+            `t_1682176142000_city` VARCHAR(20),
+            `t_1682176142000_age` SMALLINT,
+            `t_1682176142000_sex` TINYINT,
+            `t_1682176142000_last_visit_date` DATETIME REPLACE,
+            `t_1682176142000_cost` BIGINT SUM,
+            `t_1682176142000_max_dwell_time` INT MAX,
+            `t_1682176142000_min_dwell_time` INT MIN
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`t_1682176142000_user_id`, `t_1682176142000_date`,
+         `t_1682176142000_city`, `t_1682176142000_age`, `t_1682176142000_sex`)
+        PARTITION BY LIST(`t_1682176142000_date`)
+        (
+            PARTITION `p_201701` VALUES IN ("2017-10-01"),
+            PARTITION `p_201702` VALUES IN ("2017-10-02"),
+            PARTITION `p_201703` VALUES IN ("2017-10-03")
+        )
+        DISTRIBUTED BY HASH(`t_1682176142000_user_id`) BUCKETS 1
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+    """
+
+    sql """
+        INSERT INTO ${tblName} ${columnNames}
+        VALUES (10000, "2017-10-01", "北京", 20, 0, "2017-10-01 07:00:00", 15, 2, 2),
+            (10000, "2017-10-01", "北京", 20, 0, "2017-10-01 06:00:00", 20, 10, 10),
+            (10001, "2017-10-01", "北京", 30, 1, "2017-10-01 17:05:45", 2, 22, 22),
+            (10002, "2017-10-02", "上海", 20, 1, "2017-10-02 12:59:12", 200, 5, 5),
+            (10003, "2017-10-02", "广州", 32, 0, "2017-10-02 11:20:00", 30, 11, 11),
+            (10004, "2017-10-01", "深圳", 35, 0, "2017-10-01 10:00:15", 100, 3, 3),
+            (10004, "2017-10-03", "深圳", 35, 0, "2017-10-03 10:20:22", 11, 6, 6);
+    """
+
+    sql """  
+        DELETE FROM __internal_schema.column_statistics
+        WHERE col_id IN ${columnNameValues}  
+        """
+
+    // TODO delete by database name and table name
+    sql """
+        DELETE FROM __internal_schema.analysis_jobs WHERE job_id IS NOT NULL;
+        """
+
+    // 1. Firstly do a full collection of statistics
+    sql """
+        ANALYZE TABLE ${tblName} ${columnNames};
+    """
+
+     Thread.sleep(5000)
+
+    // Collecting all 9 columns will generate 9 tasks (total tasks: 9)
+    qt_sql query_analysis_jobs_count_sql

Review Comment:
   this check may fail. sleep(5000) can not guarantee this.



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1521695000

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1522833488

   run p1


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] github-actions[bot] commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1524632524

   PR approved by at least one committer and no changes requested.


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1519056084

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1521479868

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1522117587

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1523351510

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1524580380

   run p1


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] weizhengte commented on pull request #18971: [Optimization](statistics) optimize Incremental statistics collection and statistics cleaning

Posted by "weizhengte (via GitHub)" <gi...@apache.org>.
weizhengte commented on PR #18971:
URL: https://github.com/apache/doris/pull/18971#issuecomment-1524506217

   run p1


-- 
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-unsubscribe@doris.apache.org

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


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