Skip to content

Commit 1035744

Browse files
Kikyou1997pull[bot]
authored andcommitted
[fix](stats) analyze specific column only if indicate column in analyze stmt (#25660)
1 parent 5c85650 commit 1035744

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,9 @@ private Map<String, Set<String>> validateAndGetPartitions(TableIf table, Set<Str
485485
}
486486

487487
if (analysisType == AnalysisType.FUNDAMENTALS) {
488-
return table.findReAnalyzeNeededPartitions();
488+
Map<String, Set<String>> result = table.findReAnalyzeNeededPartitions();
489+
result.keySet().retainAll(columnNames);
490+
return result;
489491
}
490492

491493
return columnToPartitions;

‎regression-test/suites/statistics/analyze_stats.groovy‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,4 +1110,18 @@ PARTITION `p599` VALUES IN (599)
11101110
sql """ANALYZE TABLE test_meta_management WITH SYNC"""
11111111
afterDropped = sql """SHOW TABLE STATS test_meta_management"""
11121112
assert check_column(afterDropped, "[col1, col2, col3]")
1113+
1114+
// test analyze specific column
1115+
sql """CREATE TABLE test_analyze_specific_column (col1 varchar(11451) not null, col2 int not null, col3 int not null)
1116+
DUPLICATE KEY(col1)
1117+
DISTRIBUTED BY HASH(col1)
1118+
BUCKETS 3
1119+
PROPERTIES(
1120+
"replication_num"="1"
1121+
);"""
1122+
sql """insert into test_analyze_specific_column values('%.', 2, 1);"""
1123+
sql """ANALYZE TABLE test_analyze_specific_column(col2) WITH SYNC"""
1124+
result = sql """SHOW COLUMN STATS test_analyze_specific_column"""
1125+
assert result.size() == 1
1126+
11131127
}

0 commit comments

Comments
 (0)