FrankChen021 commented on code in PR #19678:
URL: https://github.com/apache/druid/pull/19678#discussion_r3570769775
##########
processing/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java:
##########
@@ -190,12 +191,22 @@ private static double estimateSparse(
}
e += 1.0d / Math.pow(2, upperNibble) + 1.0d / Math.pow(2, lowerNibble);
zeroCount += (((upperNibble & 0xf0) == 0) ? 1 : 0) + (((lowerNibble &
0x0f) == 0) ? 1 : 0);
+ overflowRegisterApplied = true;
Review Comment:
[P2] Normalize sparse positions before marking overflow applied
`position` is the serialized byte offset, which `toByteBuffer()` writes as
the payload index plus `getNumHeaderBytes()` (7 for a V1 sketch), while
`overflowPosition` is only `overflowRegister >>> 1`. Consequently this flag can
remain false after visiting the overflow bucket's actual sparse byte, or become
true for an unrelated entry. For example, if a bucket first receives an
in-range value and then an overflow value, a sparse round-trip stores its tuple
at `overflowPosition + 7`; the new fallback then treats the overflow as a
second previously empty register and decrements `zeroCount` again, making one
populated HLL register estimate approximately 2 instead of 1. Compare positions
in the same coordinate system before deciding whether standalone compensation
is needed.
--
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]