normanj-bitquill commented on code in PR #3927:
URL: https://github.com/apache/calcite/pull/3927#discussion_r1735101155


##########
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:
   BigInteger has a shiftleft, BigDecimal does not. I have updated the 
constants to use BigDecimal power, subtract and negate.



-- 
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]

Reply via email to