This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0eea19403e2 [fix](stats) analyze specific column only if indicate 
column in analyze stmt (#25660)
0eea19403e2 is described below

commit 0eea19403e22fda3f887f94f35bde6d211d1aa43
Author: AKIRA <33112463+kikyou1...@users.noreply.github.com>
AuthorDate: Wed Oct 25 17:08:10 2023 +0800

    [fix](stats) analyze specific column only if indicate column in analyze 
stmt (#25660)
---
 .../java/org/apache/doris/statistics/AnalysisManager.java  |  4 +++-
 regression-test/suites/statistics/analyze_stats.groovy     | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java
index 01c4e3c25ba..ca17ca7b879 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisManager.java
@@ -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;
diff --git a/regression-test/suites/statistics/analyze_stats.groovy 
b/regression-test/suites/statistics/analyze_stats.groovy
index 5f6735c7fb2..71962b94817 100644
--- a/regression-test/suites/statistics/analyze_stats.groovy
+++ b/regression-test/suites/statistics/analyze_stats.groovy
@@ -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
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to