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

lijibing 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 72a809b25a7 [fix](statistics)Skip unknown stats while show cached 
partition stats. (#36243)
72a809b25a7 is described below

commit 72a809b25a7603047ce1e38eee390074ac7d5f99
Author: Jibing-Li <64681310+jibing...@users.noreply.github.com>
AuthorDate: Thu Jun 13 17:36:33 2024 +0800

    [fix](statistics)Skip unknown stats while show cached partition stats. 
(#36243)
    
    Don't show anything if cached partition stats for a column doesn't
    exists. Before it will show default value which is misleading.
---
 .../apache/doris/analysis/ShowColumnStatsStmt.java |  3 +++
 .../suites/statistics/test_partition_stats.groovy  | 30 ++++++++++------------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowColumnStatsStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowColumnStatsStmt.java
index e538723ebb1..4290400cd10 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowColumnStatsStmt.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowColumnStatsStmt.java
@@ -235,6 +235,9 @@ public class ShowColumnStatsStmt extends ShowStmt {
         for (Map.Entry<PartitionColumnStatisticCacheKey, 
PartitionColumnStatistic> entry : resultMap.entrySet()) {
             PartitionColumnStatisticCacheKey key = entry.getKey();
             PartitionColumnStatistic value = entry.getValue();
+            if (value == null || value.isUnKnown) {
+                continue;
+            }
             List<String> row = Lists.newArrayList();
             row.add(key.colName); // column_name
             row.add(key.partId); // partition_name
diff --git a/regression-test/suites/statistics/test_partition_stats.groovy 
b/regression-test/suites/statistics/test_partition_stats.groovy
index b9239fd4d51..fdd5682504c 100644
--- a/regression-test/suites/statistics/test_partition_stats.groovy
+++ b/regression-test/suites/statistics/test_partition_stats.groovy
@@ -92,29 +92,27 @@ suite("test_partition_stats") {
 
     // Test show cached partition stats.
     sql """analyze table part with sync;"""
-    result = sql """show column cached stats part(id) partition(p1)"""
-    assertEquals(1, result.size())
-    Thread.sleep(1000)
     for (int i = 0; i < 20; i++) {
-        result = sql """show column cached stats part(id) partition(p1)"""
-        if (result[0][3] == "6.0") {
+        result = sql """show column cached stats part partition(*)"""
+        if (result.size() == 27) {
             logger.info("cache is ready.")
-            assertEquals("id", result[0][0])
-            assertEquals("p1", result[0][1])
-            assertEquals("part", result[0][2])
-            assertEquals("6.0", result[0][3])
-            assertEquals("6", result[0][4])
-            assertEquals("0.0", result[0][5])
-            assertEquals("1.0", result[0][6])
-            assertEquals("6.0", result[0][7])
-            assertEquals("24.0", result[0][8])
-            assertEquals("N/A", result[0][10])
-            assertEquals("N/A", result[0][11])
             break;
         }
         logger.info("cache is not ready yet.")
         Thread.sleep(1000)
     }
+    result = sql """show column cached stats part(id) partition(p1)"""
+    assertEquals("id", result[0][0])
+    assertEquals("p1", result[0][1])
+    assertEquals("part", result[0][2])
+    assertEquals("6.0", result[0][3])
+    assertEquals("6", result[0][4])
+    assertEquals("0.0", result[0][5])
+    assertEquals("1.0", result[0][6])
+    assertEquals("6.0", result[0][7])
+    assertEquals("24.0", result[0][8])
+    assertEquals("N/A", result[0][10])
+    assertEquals("N/A", result[0][11])
     result = sql """show column cached stats part partition(p1)"""
     assertEquals(9, result.size())
     result = sql """show column cached stats part partition(*)"""


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

Reply via email to