neilconway commented on code in PR #23913:
URL: https://github.com/apache/datafusion/pull/23913#discussion_r3667068375
##########
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:
If we try to retract a missing value, seems that we are likely to eventually
produce incorrect query results, so I'd argue it is better to raise an error
here rather than to silently proceed and return the wrong answer. I'd
personally argue for `internal_err!`; but if you disagree, then I'd say
`debug_assert!` is better than nothing 😊
--
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]