[test](statistics) add p0 test of sampling statistics (#19176)
1. Added test p0 for sampling collection statistics 2. Modify the uniqueKeys of table analysis_jobs for deletion based on relevant conditions 3. Solve the problem that incremental statistics p0 is less stable
This commit is contained in:
@ -219,7 +219,7 @@ public class AnalyzeStmt extends DdlStmt {
|
||||
|
||||
if (properties.containsKey(PROPERTY_SAMPLE_PERCENT)) {
|
||||
checkNumericProperty(PROPERTY_SAMPLE_PERCENT, properties.get(PROPERTY_SAMPLE_PERCENT),
|
||||
0, 100, false, "should be > 0 and < 100");
|
||||
1, 100, true, "should be >= 1 and <= 100");
|
||||
}
|
||||
|
||||
if (properties.containsKey(PROPERTY_SAMPLE_ROWS)) {
|
||||
|
||||
@ -190,8 +190,9 @@ public class InternalSchemaInitializer extends Thread {
|
||||
columnDefs.add(new ColumnDef("state", TypeDef.createVarchar(32)));
|
||||
columnDefs.add(new ColumnDef("schedule_type", TypeDef.createVarchar(32)));
|
||||
String engineName = "olap";
|
||||
KeysDesc keysDesc = new KeysDesc(KeysType.UNIQUE_KEYS,
|
||||
Lists.newArrayList("job_id", "task_id"));
|
||||
ArrayList<String> uniqueKeys = Lists.newArrayList("job_id", "task_id",
|
||||
"catalog_name", "db_name", "tbl_name", "col_name", "index_id");
|
||||
KeysDesc keysDesc = new KeysDesc(KeysType.UNIQUE_KEYS, uniqueKeys);
|
||||
|
||||
DistributionDesc distributionDesc = new HashDistributionDesc(
|
||||
StatisticConstants.STATISTIC_TABLE_BUCKET_COUNT,
|
||||
|
||||
@ -86,7 +86,8 @@ public class HistogramTask extends BaseAnalysisTask {
|
||||
if (info.samplePercent > 0) {
|
||||
return String.valueOf(info.samplePercent / 100.0);
|
||||
} else {
|
||||
double sampRate = (double) info.sampleRows / tbl.getRowCount();
|
||||
long rowCount = tbl.getRowCount() > 0 ? tbl.getRowCount() : 1;
|
||||
double sampRate = (double) info.sampleRows / rowCount;
|
||||
return sampRate >= 1 ? "1.0" : String.format("%.4f", sampRate);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user