strongduanmu commented on code in PR #4074:
URL: https://github.com/apache/calcite/pull/4074#discussion_r1881183482


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -2916,6 +2916,46 @@ public static long bitCount(ByteString b) {
     return bitsSet;
   }
 
+  /** Helper function for implementing MySQL <code>BIT_COUNT</code>. Counts 
the number
+   * of bits set in a boolean value. */
+  public static long bitCountMySQL(Boolean b) {
+    return Long.bitCount(b ? 1L : 0L);
+  }
+
+  /** Helper function for implementing MySQL <code>BIT_COUNT</code>. Counts 
the number
+   * of bits set in a string value. */

Review Comment:
   This is MySQL BIT_COUNT function document - 
https://dev.mysql.com/doc/refman/8.4/en/bit-functions.html#bit-operations-bit-count,
 but unfortunately, it does not describe the details about the BIT_COUNT 
function. These special behaviors of BIT_COUNT come from actual tests with 
MySQL.



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