Skip to content

Commit

Permalink
[core] Improve TruncateSimpleColStatsCollector performance (#4338)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses-you authored Oct 16, 2024
1 parent 3825f43 commit 668e673
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public void collect(Object field, Serializer<Object> fieldSerializer) {
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;
Expand All @@ -66,7 +71,12 @@ public void collect(Object field, Serializer<Object> fieldSerializer) {
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);
}
}
}
}
Expand Down

0 comments on commit 668e673

Please sign in to comment.