viirya commented on code in PR #23913:
URL: https://github.com/apache/datafusion/pull/23913#discussion_r3667165480
##########
datafusion/functions-aggregate/src/percentile_cont.rs:
##########
@@ -713,7 +745,12 @@ where
let arr = values[0].as_primitive::<T>();
for value in arr.iter().flatten() {
- self.distinct_values.values.remove(&Hashable(value));
+ if let Some(count) = self.counts.get_mut(&Hashable(value)) {
+ *count -= 1;
+ if *count == 0 {
+ self.counts.remove(&Hashable(value));
+ }
+ }
Review Comment:
Agreed — returning a wrong answer is worse than failing loudly here. Went
with `internal_err!` in #23946: retracting a value not in the count map now
surfaces as an error rather than silently proceeding. Thanks!
--
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]