[minor](stats) Update olap table row count after analyze (#27814)
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
package org.apache.doris.statistics;
|
||||
|
||||
import org.apache.doris.catalog.Column;
|
||||
import org.apache.doris.catalog.OlapTable;
|
||||
import org.apache.doris.catalog.TableIf;
|
||||
import org.apache.doris.common.io.Text;
|
||||
import org.apache.doris.common.io.Writable;
|
||||
@ -25,6 +26,7 @@ import org.apache.doris.persist.gson.GsonUtils;
|
||||
import org.apache.doris.statistics.AnalysisInfo.JobType;
|
||||
import org.apache.doris.statistics.util.StatisticsUtil;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.DataInput;
|
||||
@ -54,7 +56,7 @@ public class TableStatsMeta implements Writable {
|
||||
|
||||
// Used for external table.
|
||||
@SerializedName("rowCount")
|
||||
public final long rowCount;
|
||||
public long rowCount;
|
||||
|
||||
@SerializedName("updateTime")
|
||||
public long updatedTime;
|
||||
@ -65,6 +67,12 @@ public class TableStatsMeta implements Writable {
|
||||
@SerializedName("trigger")
|
||||
public JobType jobType;
|
||||
|
||||
@VisibleForTesting
|
||||
public TableStatsMeta() {
|
||||
tblId = 0;
|
||||
idxId = 0;
|
||||
}
|
||||
|
||||
// It's necessary to store these fields separately from AnalysisInfo, since the lifecycle between AnalysisInfo
|
||||
// and TableStats is quite different.
|
||||
public TableStatsMeta(long rowCount, AnalysisInfo analyzedJob, TableIf table) {
|
||||
@ -136,11 +144,16 @@ public class TableStatsMeta implements Writable {
|
||||
}
|
||||
}
|
||||
jobType = analyzedJob.jobType;
|
||||
if (tableIf != null && analyzedJob.colToPartitions.keySet()
|
||||
.containsAll(tableIf.getBaseSchema().stream()
|
||||
.filter(c -> !StatisticsUtil.isUnsupportedType(c.getType()))
|
||||
.map(Column::getName).collect(Collectors.toSet()))) {
|
||||
updatedRows.set(0);
|
||||
if (tableIf != null) {
|
||||
if (tableIf instanceof OlapTable) {
|
||||
rowCount = tableIf.getRowCount();
|
||||
}
|
||||
if (analyzedJob.colToPartitions.keySet()
|
||||
.containsAll(tableIf.getBaseSchema().stream()
|
||||
.filter(c -> !StatisticsUtil.isUnsupportedType(c.getType()))
|
||||
.map(Column::getName).collect(Collectors.toSet()))) {
|
||||
updatedRows.set(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user