weizhengte commented on code in PR #18801:
URL: https://github.com/apache/doris/pull/18801#discussion_r1171012809
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java:
##########
@@ -111,42 +147,37 @@ public void createAnalysisJob(AnalyzeStmt analyzeStmt)
throws DdlException {
analysisTaskInfos.values().forEach(taskScheduler::schedule);
}
- private void persistAnalysisJob(String catalogName, String db, TableName
tbl,
- long jobId) throws DdlException {
+ private void persistAnalysisJob(AnalysisTaskInfoBuilder taskInfoBuilder)
throws DdlException {
try {
- AnalysisTaskInfo analysisTaskInfo = new
AnalysisTaskInfoBuilder().setJobId(
- jobId).setTaskId(-1)
- .setCatalogName(catalogName).setDbName(db)
- .setTblName(tbl.getTbl())
- .setJobType(JobType.MANUAL)
-
.setAnalysisMethod(AnalysisMethod.FULL).setAnalysisType(AnalysisType.INDEX)
- .setScheduleType(ScheduleType.ONCE).build();
+ AnalysisTaskInfoBuilder jobInfoBuilder =
taskInfoBuilder.deepCopy();
+ AnalysisTaskInfo analysisTaskInfo =
jobInfoBuilder.setTaskId(-1).build();
StatisticsRepository.persistAnalysisTask(analysisTaskInfo);
} catch (Throwable t) {
throw new DdlException(t.getMessage(), t);
}
}
- private void createTaskForMVIdx(AnalyzeStmt analyzeStmt, String
catalogName, String db, TableName tbl,
- Map<Long, AnalysisTaskInfo> analysisTaskInfos, long jobId) throws
DdlException {
- if (!(analyzeStmt.isWholeTbl &&
analyzeStmt.getTable().getType().equals(TableType.OLAP))) {
- return;
+ private void createTaskForMVIdx(TableIf table, AnalysisTaskInfoBuilder
taskInfoBuilder,
+ Map<Long, AnalysisTaskInfo> analysisTaskInfos, AnalysisType
analysisType) throws DdlException {
+ TableType type = table.getType();
+ if (analysisType != AnalysisType.INDEX ||
!type.equals(TableType.OLAP)) {
+ return; // not need to collect statistics for materialized view
}
- OlapTable olapTable = (OlapTable) analyzeStmt.getTable();
+
+ taskInfoBuilder.setAnalysisType(analysisType);
+ OlapTable olapTable = (OlapTable) table;
+
try {
- olapTable.readLock();
+ table.readLock();
Review Comment:
yes, you're right. here is what I accidentally changed
--
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]