This is an automated email from the ASF dual-hosted git repository.
lijibing pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 6ae2106cd9e branch-2.1: [improvement](statistics)Remove useless stats
validation check. (#43499)
6ae2106cd9e is described below
commit 6ae2106cd9efa5873399308e191374a1a53462e0
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Nov 12 16:00:35 2024 +0800
branch-2.1: [improvement](statistics)Remove useless stats validation check.
(#43499)
Cherry-picked from #43279
Co-authored-by: Jibing-Li <[email protected]>
---
.../src/main/java/org/apache/doris/statistics/ColStatsData.java | 5 -----
.../org/apache/doris/statistics/ColumnStatisticsCacheLoader.java | 8 --------
.../main/java/org/apache/doris/statistics/StatisticsCache.java | 5 +----
regression-test/suites/statistics/analyze_stats.groovy | 4 +---
4 files changed, 2 insertions(+), 20 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColStatsData.java
b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColStatsData.java
index bb826399458..cc79f779f6e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColStatsData.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColStatsData.java
@@ -131,11 +131,6 @@ public class ColStatsData {
}
public ColumnStatistic toColumnStatistic() {
- // For non-empty table, return UNKNOWN if we can't collect ndv value.
- // Because inaccurate ndv is very misleading.
- if (count > 0 && ndv == 0 && count != nullCount) {
- return ColumnStatistic.UNKNOWN;
- }
try {
ColumnStatisticBuilder columnStatisticBuilder = new
ColumnStatisticBuilder();
columnStatisticBuilder.setCount(count);
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java
b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java
index cca5e347177..c937b077fc5 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java
@@ -49,14 +49,6 @@ public class ColumnStatisticsCacheLoader extends
BasicAsyncCacheLoader<Statistic
}
return null;
}
- if (columnStatistic.isPresent()) {
- // For non-empty table, return UNKNOWN if we can't collect ndv
value.
- // Because inaccurate ndv is very misleading.
- ColumnStatistic stats = columnStatistic.get();
- if (stats.count > 0 && stats.ndv == 0 && stats.count !=
stats.numNulls) {
- columnStatistic = Optional.of(ColumnStatistic.UNKNOWN);
- }
- }
return columnStatistic;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCache.java
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCache.java
index d86e073d9e4..86851ee8007 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCache.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCache.java
@@ -192,10 +192,7 @@ public class StatisticsCache {
final StatisticsCacheKey k =
new StatisticsCacheKey(statsId.catalogId,
statsId.dbId, statsId.tblId, statsId.idxId,
statsId.colId);
- ColumnStatistic c = ColumnStatistic.fromResultRow(r);
- if (c.count > 0 && c.ndv == 0 && c.count != c.numNulls) {
- c = ColumnStatistic.UNKNOWN;
- }
+ final ColumnStatistic c = ColumnStatistic.fromResultRow(r);
putCache(k, c);
} catch (Throwable t) {
LOG.warn("Error when preheating stats cache. reason: [{}].
Row:[{}]", t.getMessage(), r);
diff --git a/regression-test/suites/statistics/analyze_stats.groovy
b/regression-test/suites/statistics/analyze_stats.groovy
index 13a34d1dae9..b4edc5e9d7b 100644
--- a/regression-test/suites/statistics/analyze_stats.groovy
+++ b/regression-test/suites/statistics/analyze_stats.groovy
@@ -2759,9 +2759,7 @@ PARTITION `p599` VALUES IN (599)
logger.info("show column alter_test(id) stats: " + alter_result)
assertEquals(1, alter_result.size())
alter_result = sql """show column cached stats alter_test(id)"""
- assertEquals(0, alter_result.size())
- alter_result = sql """show column cached stats alter_test(id)"""
- assertEquals(0, alter_result.size())
+ assertEquals(1, alter_result.size())
sql """alter table alter_test modify column id set stats
('row_count'='100', 'ndv'='0', 'num_nulls'='100', 'data_size'='2.69975443E8',
'min_value'='1', 'max_value'='2');"""
alter_result = sql """show column stats alter_test(id)"""
logger.info("show column alter_test(id) stats: " + alter_result)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]