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


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java:
##########
@@ -91,16 +91,52 @@ public StatisticsCache getStatisticsCache() {
 
     // Each analyze stmt corresponding to an analysis job.
     public void createAnalysisJob(AnalyzeStmt analyzeStmt) throws DdlException 
{
+        Map<Long, AnalysisTaskInfo> analysisTaskInfos = new HashMap<>();
+        AnalysisTaskInfoBuilder taskInfoBuilder = new 
AnalysisTaskInfoBuilder();
+
+        long jobId = Env.getCurrentEnv().getNextId();
         String catalogName = analyzeStmt.getCatalogName();
         String db = analyzeStmt.getDBName();
+        TableIf table = analyzeStmt.getTable();
         TableName tbl = analyzeStmt.getTblName();
         StatisticsUtil.convertTableNameToObjects(tbl);
+        String tblName = tbl.getTbl();
         Set<String> colNames = analyzeStmt.getColumnNames();
-        Map<Long, AnalysisTaskInfo> analysisTaskInfos = new HashMap<>();
-        long jobId = Env.getCurrentEnv().getNextId();
-        createTaskForEachColumns(analyzeStmt, catalogName, db, tbl, colNames, 
analysisTaskInfos, jobId);
-        createTaskForMVIdx(analyzeStmt, catalogName, db, tbl, 
analysisTaskInfos, jobId);
-        persistAnalysisJob(catalogName, db, tbl, jobId);
+        int samplePercent = analyzeStmt.getSamplePercent();
+        int sampleRows = analyzeStmt.getSampleRows();
+        AnalysisType analysisType = analyzeStmt.getAnalysisType();
+
+        // set common properties
+        taskInfoBuilder.setJobId(jobId);
+        taskInfoBuilder.setCatalogName(catalogName);
+        taskInfoBuilder.setDbName(db);
+        taskInfoBuilder.setTblName(tblName);
+        taskInfoBuilder.setJobType(JobType.MANUAL);
+        taskInfoBuilder.setState(AnalysisState.PENDING);
+        taskInfoBuilder.setScheduleType(ScheduleType.ONCE);
+
+        if (samplePercent > 0 || sampleRows > 0) {

Review Comment:
   Better to add method in `AnalyzeStmt` to determine if is sample analyze



-- 
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