[fix](stats) analyze specific column only if indicate column in analyze stmt (#25660)

This commit is contained in:
AKIRA
2023-10-25 17:08:10 +08:00
committed by GitHub
parent 8a03a07339
commit 0eea19403e
2 changed files with 17 additions and 1 deletions

View File

@ -485,7 +485,9 @@ public class AnalysisManager extends Daemon implements Writable {
}
if (analysisType == AnalysisType.FUNDAMENTALS) {
return table.findReAnalyzeNeededPartitions();
Map<String, Set<String>> result = table.findReAnalyzeNeededPartitions();
result.keySet().retainAll(columnNames);
return result;
}
return columnToPartitions;

View File

@ -1110,4 +1110,18 @@ PARTITION `p599` VALUES IN (599)
sql """ANALYZE TABLE test_meta_management WITH SYNC"""
afterDropped = sql """SHOW TABLE STATS test_meta_management"""
assert check_column(afterDropped, "[col1, col2, col3]")
// test analyze specific column
sql """CREATE TABLE test_analyze_specific_column (col1 varchar(11451) not null, col2 int not null, col3 int not null)
DUPLICATE KEY(col1)
DISTRIBUTED BY HASH(col1)
BUCKETS 3
PROPERTIES(
"replication_num"="1"
);"""
sql """insert into test_analyze_specific_column values('%.', 2, 1);"""
sql """ANALYZE TABLE test_analyze_specific_column(col2) WITH SYNC"""
result = sql """SHOW COLUMN STATS test_analyze_specific_column"""
assert result.size() == 1
}