github-actions[bot] commented on code in PR #63472:
URL: https://github.com/apache/doris/pull/63472#discussion_r3279583527
##########
be/src/util/percentile_util.h:
##########
@@ -54,16 +54,39 @@ class Counts {
}
void increment(Ty key, uint32_t i) {
+ if constexpr (std::is_floating_point_v<Ty>) {
+ if (std::isnan(key)) {
+ return;
Review Comment:
This early return can leave a floating-point `Counts` object with no values
when every input is NaN. The old `percentile`/`percentile_array` path still
serializes `Counts` for distributed aggregation, and `Counts::serialize()`
handles an empty `_nums` by calling `_convert_sorted_num_vec_to_nums()` and
then recursively calling `serialize(buf)` again. If `_sorted_nums_vec` is also
empty, as in `select percentile(cast('nan' as double), 0.5)` on this path,
`_nums` remains empty and serialization recurses until stack overflow. Please
make the empty state serializable directly, or avoid creating an initialized
empty `Counts` state when all values are skipped, and add an all-NaN test that
exercises aggregation-state serialization.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]