This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 668e67335 [core] Improve TruncateSimpleColStatsCollector performance
(#4338)
668e67335 is described below
commit 668e673353f7a02aa6e160b3ac2f84e8c6746aad
Author: Xiduo You <[email protected]>
AuthorDate: Wed Oct 16 19:11:56 2024 +0800
[core] Improve TruncateSimpleColStatsCollector performance (#4338)
---
.../paimon/statistics/TruncateSimpleColStatsCollector.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git
a/paimon-common/src/main/java/org/apache/paimon/statistics/TruncateSimpleColStatsCollector.java
b/paimon-common/src/main/java/org/apache/paimon/statistics/TruncateSimpleColStatsCollector.java
index 926e287f3..cba942c79 100644
---
a/paimon-common/src/main/java/org/apache/paimon/statistics/TruncateSimpleColStatsCollector.java
+++
b/paimon-common/src/main/java/org/apache/paimon/statistics/TruncateSimpleColStatsCollector.java
@@ -53,6 +53,11 @@ public class TruncateSimpleColStatsCollector extends
AbstractSimpleColStatsColle
return;
}
+ // fast fail since the result is not correct
+ if (failed) {
+ return;
+ }
+
// TODO use comparator for not comparable types and extract this logic
to a util class
if (!(field instanceof Comparable)) {
return;
@@ -66,7 +71,12 @@ public class TruncateSimpleColStatsCollector extends
AbstractSimpleColStatsColle
Object max = truncateMax(field);
// may fail
if (max != null) {
- maxValue = fieldSerializer.copy(truncateMax(field));
+ if (max != field) {
+ // copied in `truncateMax`
+ maxValue = max;
+ } else {
+ maxValue = fieldSerializer.copy(max);
+ }
}
}
}