Check input value is duplicated when quantile queue is full (#7091)

Co-authored-by: Taewoo Kim <taewoo@layer6.com>
This commit is contained in:
Taewoo Kim 2021-07-22 15:07:01 -04:00 committed by GitHub
parent caa9e527dd
commit 41e882f80b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -575,7 +575,7 @@ class QuantileSketchTemplate {
*/
inline void Push(DType x, RType w = 1) {
if (w == static_cast<RType>(0)) return;
if (inqueue.qtail == inqueue.queue.size()) {
if (inqueue.qtail == inqueue.queue.size() && inqueue.queue[inqueue.qtail - 1].value != x) {
// jump from lazy one value to limit_size * 2
if (inqueue.queue.size() == 1) {
inqueue.queue.resize(limit_size * 2);