Kikyou1997 commented on code in PR #18653:
URL: https://github.com/apache/doris/pull/18653#discussion_r1166242504
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java:
##########
@@ -100,16 +98,24 @@ public void createAnalysisJob(AnalyzeStmt analyzeStmt)
throws DdlException {
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.
- // we cannot collect histograms incrementally and do not support it
+ // we cannot collect histograms incrementally and do not support it.
if (!analyzeStmt.isIncrement && !analyzeStmt.isHistogram) {
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());
- StatisticsRepository.dropStatistics(dbId, tblIds, colNames,
partIds);
+ try {
+ StatisticsRepository.markStatsAsDeleted(dbId, tblIds,
colNames, partIds);
+ } catch (Exception e) {
+ throw new DdlException("Fail to mark statistics as deleted",
e);
+ }
+ // Removing statistics maybe be slow and use asynchronous method
+ Env.getCurrentEnv().getAnalysisHelper().asyncExecute(() ->
+ StatisticsRepository.dropStatistics(dbId, tblIds,
colNames, partIds));
Review Comment:
It's really puzzling here, if you has an insatiable craving for deletion
here AND submit a async task to do this, then what's the necessary to update
`column_statistics` table synchronously to mark a row should be deleted instead
of let async task delete them directly
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]