This is an automated email from the ASF dual-hosted git repository.
lijibing pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new c3464c87770 [improvement](statistics)Remove useless stats validation
check. (#43279) (#43558)
c3464c87770 is described below
commit c3464c87770abe99735f81def3bf79d922bcb2b5
Author: Jibing-Li <[email protected]>
AuthorDate: Mon Nov 11 12:57:37 2024 +0800
[improvement](statistics)Remove useless stats validation check. (#43279)
(#43558)
backport: https://github.com/apache/doris/pull/43279
---
.../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 | 6 +-----
regression-test/suites/statistics/analyze_stats.groovy | 4 +---
4 files changed, 2 insertions(+), 21 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 42d5d542359..1876cacc003 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
@@ -51,14 +51,6 @@ public class ColumnStatisticsCacheLoader extends
BasicAsyncCacheLoader<Statistic
// it will trigger load function again without cache an empty
value.
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 af5958d7402..fae6fd0555f 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
@@ -171,12 +171,8 @@ public class StatisticsCache {
long tblId = statsId.tblId;
long idxId = statsId.idxId;
String colId = statsId.colId;
- final StatisticsCacheKey k =
- new StatisticsCacheKey(tblId, idxId, colId);
+ final StatisticsCacheKey k = new StatisticsCacheKey(tblId,
idxId, colId);
ColumnStatistic c = ColumnStatistic.fromResultRow(r);
- if (c.count > 0 && c.ndv == 0 && c.count != c.numNulls) {
- c = ColumnStatistic.UNKNOWN;
- }
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 993e6f531da..c828274a403 100644
--- a/regression-test/suites/statistics/analyze_stats.groovy
+++ b/regression-test/suites/statistics/analyze_stats.groovy
@@ -2706,9 +2706,7 @@ PARTITION `p599` VALUES IN (599)
alter_result = sql """show column stats alter_test(id)"""
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)"""
assertEquals(1, alter_result.size())
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]