You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The BITCOUNT function incorrectly counts BINARY/VARBINARY values of >=16 bytes. #3645
BITCOUNT(X'ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00') returns 120 rather than the expected value of 64. It appears to be double counting the 2nd-to-8th bytes, and ignoring the 10th-to-16th bytes.
Removing the last 00 will stop this behaviour and cause it to return 64. Adding another 8 zero bytes will cause it to triple-count many of the ff bytes.
I think I know why. In BitFunction.bitCount(), I believe the line reading c += Long.bitCount(Bits.readLong(bytes, i)); should actually be c += Long.bitCount(Bits.readLong(bytes, i << 3));.
Activity