normanj-bitquill commented on code in PR #3927:
URL: https://github.com/apache/calcite/pull/3927#discussion_r1733310098
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -2834,6 +2834,42 @@ public static ByteString bitAnd(ByteString b0,
ByteString b1) {
return binaryOperator(b0, b1, (x, y) -> (byte) (x & y));
}
+ /** Helper function for implementing <code>BITCOUNT</code>. Counts the number
+ * of bits set in an integer value. */
+ public static long bitCount(long b) {
+ return Long.bitCount(b);
+ }
+
+ private static final BigDecimal BITCOUNT_MAX = new
BigDecimal("18446744073709551615");
Review Comment:
This is `2^64 - 1`. I found it through testing in MySQL. I added a comment
to say that it is `2^64 - 1`.
--
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]