Skip to content

Commit 065f55b

Browse files
committed
Fix partition name NPE and sample for all table during auto analyze.
1 parent aca8406 commit 065f55b

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,7 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) {
14301430
+ "When enable_auto_sample is enabled, tables"
14311431
+ "larger than this value will automatically collect "
14321432
+ "statistics through sampling"})
1433-
public long hugeTableLowerBoundSizeInBytes = 5L * 1024 * 1024 * 1024;
1433+
public long hugeTableLowerBoundSizeInBytes = 0;
14341434

14351435
@VariableMgr.VarAttr(name = HUGE_TABLE_AUTO_ANALYZE_INTERVAL_IN_MILLIS, flag = VariableMgr.GLOBAL,
14361436
description = {"控制对大表的自动ANALYZE的最小时间间隔,"

fe/fe-core/src/main/java/org/apache/doris/statistics/OlapAnalysisTask.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ public OlapAnalysisTask(AnalysisInfo info) {
6161

6262
public void doExecute() throws Exception {
6363
Set<String> partitionNames = info.colToPartitions.get(info.colName);
64-
if (partitionNames.isEmpty()) {
64+
if (partitionNames == null || partitionNames.isEmpty()) {
65+
if (partitionNames == null) {
66+
LOG.warn("partitionNames for column {} is null. ColToPartitions:[{}]",
67+
info.colName, info.colToPartitions);
68+
}
6569
StatsId statsId = new StatsId(concatColumnStatsId(), info.catalogId, info.dbId,
6670
info.tblId, info.indexId, info.colName, null);
6771
job.appendBuf(this, Arrays.asList(new ColStatsData(statsId)));

fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticConstants.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public class StatisticConstants {
8686
public static final int INSERT_MERGE_ITEM_COUNT = 200;
8787

8888
public static final long HUGE_TABLE_DEFAULT_SAMPLE_ROWS = 4194304;
89-
public static final long HUGE_TABLE_LOWER_BOUND_SIZE_IN_BYTES = 5L * 1024 * 1024 * 1024;
89+
public static final long HUGE_TABLE_LOWER_BOUND_SIZE_IN_BYTES = 0;
9090

9191
public static final long HUGE_TABLE_AUTO_ANALYZE_INTERVAL_IN_MILLIS = TimeUnit.HOURS.toMillis(12);
9292

fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsAutoCollector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected boolean skip(TableIf table) {
148148

149149
protected void createAnalyzeJobForTbl(DatabaseIf<? extends TableIf> db,
150150
List<AnalysisInfo> analysisInfos, TableIf table) {
151-
AnalysisMethod analysisMethod = table.getDataSize(true) > StatisticsUtil.getHugeTableLowerBoundSizeInBytes()
151+
AnalysisMethod analysisMethod = table.getDataSize(true) >= StatisticsUtil.getHugeTableLowerBoundSizeInBytes()
152152
? AnalysisMethod.SAMPLE : AnalysisMethod.FULL;
153153
AnalysisInfo jobInfo = new AnalysisInfoBuilder()
154154
.setJobId(Env.getCurrentEnv().getNextId())

0 commit comments

Comments
 (0)