zhengte commented on a change in pull request #8348:
URL: https://github.com/apache/incubator-doris/pull/8348#discussion_r838464561
##########
File path:
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsJob.java
##########
@@ -40,40 +47,166 @@
SCHEDULING,
RUNNING,
FINISHED,
- CANCELLED
+ CANCELLED,
+ FAILED
}
- private long id = -1;
+ private final long id;
+
+ /**
+ * to be collected database stats.
+ */
+ private final long dbId;
+
+ /**
+ * to be collected table stats.
+ */
+ private final List<Long> tableIds;
+
+ /**
+ * to be collected column stats.
+ */
+ private final Map<Long, List<String>> tableIdToColumnName;
+
+ /**
+ * to be executed tasks.
+ */
+ private final List<StatisticsTask> tasks;
+
+ /**
+ * The progress of the job, it's equal to the number of completed tasks.
+ */
+ private int progress = 0;
private JobState jobState = JobState.PENDING;
- // optional
- // to be collected table stats
- private List<Long> tableId = Lists.newArrayList();
- // to be collected column stats
- private Map<Long, List<String>> tableIdToColumnName = Maps.newHashMap();
- private Map<String, String> properties;
- // end
- private List<StatisticsTask> taskList = Lists.newArrayList();
+ public StatisticsJob(Long dbId, List<Long> tableIdList, Map<Long,
List<String>> tableIdToColumnName) {
+ this.id = Catalog.getCurrentCatalog().getNextId();
+ this.dbId = dbId;
+ this.tableIds = tableIdList;
+ this.tableIdToColumnName = tableIdToColumnName;
+ this.tasks = Lists.newArrayList();
+ }
public long getId() {
return id;
}
- /*
- AnalyzeStmt: Analyze t1(c1), t2
- StatisticsJob:
- tableId [t1, t2]
- tableIdToColumnName <t1, [c1]> <t2, [c1,c2,c3]>
- */
- public static StatisticsJob fromAnalyzeStmt(AnalyzeStmt analyzeStmt) {
- // TODO
- return new StatisticsJob();
+ public long getDbId() {
+ return dbId;
+ }
+
+ public List<Long> getTableIds() {
+ return tableIds;
+ }
+
+ public Map<Long, List<String>> getTableIdToColumnName() {
+ return tableIdToColumnName;
+ }
+
+ public List<StatisticsTask> getTasks() {
+ return tasks;
+ }
+
+ public int getProgress() {
+ return progress;
+ }
+
+ public void setProgress(int progress) {
+ this.progress = progress;
+ }
+
+ public JobState getJobState() {
+ return jobState;
+ }
+
+ public void setJobState(JobState jobState) {
+ this.jobState = jobState;
+ }
+
+ /**
+ * get statisticsJob from analyzeStmt.
+ * AnalyzeStmt: analyze t1(c1,c2,c3)
+ * tableId: [t1]
+ * tableIdToColumnName <t1, [c1,c2,c3]>
+ */
+ public static StatisticsJob fromAnalyzeStmt(AnalyzeStmt analyzeStmt)
throws DdlException {
+ long dbId;
+ final List<Long> tableIdList = Lists.newArrayList();
+ final Map<Long, List<String>> tableIdToColumnName = Maps.newHashMap();
+ final TableName dbTableName = analyzeStmt.getTableName();
+
+ // analyze table
Review comment:
ok
--
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]