Kikyou1997 commented on code in PR #18069:
URL: https://github.com/apache/doris/pull/18069#discussion_r1147266536


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java:
##########
@@ -94,6 +97,22 @@ public void createAnalysisJob(AnalyzeStmt analyzeStmt) {
         Set<String> partitionNames = analyzeStmt.getPartitionNames();
         Map<Long, AnalysisTaskInfo> analysisTaskInfos = new HashMap<>();
         long jobId = Env.getCurrentEnv().getNextId();
+
+        // If the analysis is not incremental, need to delete existing 
statistics.
+        if (!analyzeStmt.isIncrement) {
+            long dbId = analyzeStmt.getDbId();
+            TableIf table = analyzeStmt.getTable();
+            Set<Long> tblIds = Sets.newHashSet(table.getId());
+            Set<Long> partIds = partitionNames.stream()
+                    .map(p -> table.getPartition(p).getId())
+                    .collect(Collectors.toSet());
+            if (analyzeStmt.isHistogram) {
+                StatisticsRepository.dropHistogram(dbId, tblIds, colNames, 
partIds);

Review Comment:
   redundant logical I think, old value would be overwritten at unique model 



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

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

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


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

Reply via email to