NobiGo commented on code in PR #3927:
URL: https://github.com/apache/calcite/pull/3927#discussion_r1726844815
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -1123,6 +1123,16 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding
operatorBinding,
public static final SqlSpecialOperator NOT_RLIKE =
new SqlLikeOperator("NOT RLIKE", SqlKind.RLIKE, true, true);
+ @LibraryOperator(libraries = {MYSQL})
+ public static final SqlFunction BIT_COUNT_MYSQL =
Review Comment:
If only the name is different, you can try API use a copy of this function
with a given name, like:
```
/** Alias for {@link #BIT_GET}. */
@LibraryOperator(libraries = {SPARK})
public static final SqlFunction GETBIT =
BIT_GET.withName("GETBIT");
```
##########
site/_docs/reference.md:
##########
@@ -2752,6 +2752,8 @@ In the following:
| * | ATANH(numeric) | Returns the inverse
hyperbolic tangent of *numeric*
| f | BITAND_AGG(value) | Equivalent to
`BIT_AND(value)`
| f | BITOR_AGG(value) | Equivalent to
`BIT_OR(value)`
+| * | BITCOUNT(integer) | Returns the bitwise
COUNT of non-null *integer*
Review Comment:
Then the test case maybe should include a negative number and zero.
##########
site/_docs/reference.md:
##########
@@ -2752,6 +2752,8 @@ In the following:
| * | ATANH(numeric) | Returns the inverse
hyperbolic tangent of *numeric*
| f | BITAND_AGG(value) | Equivalent to
`BIT_AND(value)`
| f | BITOR_AGG(value) | Equivalent to
`BIT_OR(value)`
+| * | BITCOUNT(integer) | Returns the bitwise
COUNT of non-null *integer*
Review Comment:
In MYSQL:
```
select bit_count(3.5); return 1
select bit_count(3); return 2
select bit_count(5.5); return 2
```
So support float number?
##########
core/src/test/resources/sql/functions.iq:
##########
@@ -18,6 +18,17 @@
!use mysqlfunc
!set outputformat mysql
+# BIT_COUNT
Review Comment:
```
# BIT Functions
# BIT_COUNT
```
--
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]