Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix](statistics) Fix partition name NPE and sample for all table during auto analyze (#28916) #29199

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ public void setMaxJoinNumberOfReorder(int maxJoinNumberOfReorder) {
+ "When enable_auto_sample is enabled, tables"
+ "larger than this value will automatically collect "
+ "statistics through sampling"})
public long hugeTableLowerBoundSizeInBytes = 5L * 1024 * 1024 * 1024;
public long hugeTableLowerBoundSizeInBytes = 0;

@VariableMgr.VarAttr(name = HUGE_TABLE_AUTO_ANALYZE_INTERVAL_IN_MILLIS, flag = VariableMgr.GLOBAL,
description = {"控制对大表的自动ANALYZE的最小时间间隔,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class StatisticConstants {
public static final int INSERT_MERGE_ITEM_COUNT = 200;

public static final long HUGE_TABLE_DEFAULT_SAMPLE_ROWS = 4194304;
public static final long HUGE_TABLE_LOWER_BOUND_SIZE_IN_BYTES = 5L * 1024 * 1024 * 1024;
public static final long HUGE_TABLE_LOWER_BOUND_SIZE_IN_BYTES = 0;

public static final long HUGE_TABLE_AUTO_ANALYZE_INTERVAL_IN_MILLIS = TimeUnit.HOURS.toMillis(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected boolean skip(TableIf table) {

protected void createAnalyzeJobForTbl(DatabaseIf<? extends TableIf> db,
List<AnalysisInfo> analysisInfos, TableIf table) {
AnalysisMethod analysisMethod = table.getDataSize(true) > StatisticsUtil.getHugeTableLowerBoundSizeInBytes()
AnalysisMethod analysisMethod = table.getDataSize(true) >= StatisticsUtil.getHugeTableLowerBoundSizeInBytes()
? AnalysisMethod.SAMPLE : AnalysisMethod.FULL;
AnalysisInfo jobInfo = new AnalysisInfoBuilder()
.setJobId(Env.getCurrentEnv().getNextId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void testAutoSampleSmallTable(@Mocked HMSExternalTable tableIf)
new MockUp<HMSExternalTable>() {
@Mock
public long getDataSize(boolean singleReplica) {
return 1000;
return StatisticsUtil.getHugeTableLowerBoundSizeInBytes() - 1;
}
};
HMSAnalysisTask task = new HMSAnalysisTask();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void testSample3(@Mocked OlapTable tbl) {

@Mock
public long getDataSize(boolean singleReplica) {
return 1000;
return StatisticsUtil.getHugeTableLowerBoundSizeInBytes() - 1;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public List<Column> getBaseSchema() {

@Mock
public long getDataSize(boolean singleReplica) {
return 1000;
return StatisticsUtil.getHugeTableLowerBoundSizeInBytes() - 1;
}

@Mock
Expand Down
Loading