[ 
https://issues.apache.org/jira/browse/CALCITE-3697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Norman Jordan updated CALCITE-3697:
-----------------------------------
    Description: 
Implement bit_count function

MySQL BIT_COUNT: 
[https://dev.mysql.com/doc/refman/8.4/en/bit-functions.html#bit-operations-bit-count]

 

Examples:

 
||Expression||Result||
|bitcount(0)|0|
|bitcount(1)|1|
|bitcount(39)|4|
|bitcount(cast(x'ad') as BINARY(1)))|5|
|bitcount(-1)|64|

 

 

MySQL will handle decimal values as unsigned long values. For decimal values, 
only the integer portion is examined.

 
||Expression||Result||
|bit_count(5.23)|2|
|bit_count(18446744073709551615)|64|
|bit_count(18446744073709551616)|63|
|bit_count(18446744073709551617)|63|
|bit_count(-9223372036854775808)|1|
|bit_count(-9223372036854775809)|1|

 

 

  was:
Implement bit_count function

MySQL BIT_COUNT: 
https://dev.mysql.com/doc/refman/8.4/en/bit-functions.html#bit-operations-bit-count


> Implement BITCOUNT scalar function
> ----------------------------------
>
>                 Key: CALCITE-3697
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3697
>             Project: Calcite
>          Issue Type: Sub-task
>            Reporter: Forward Xu
>            Assignee: Forward Xu
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Implement bit_count function
> MySQL BIT_COUNT: 
> [https://dev.mysql.com/doc/refman/8.4/en/bit-functions.html#bit-operations-bit-count]
>  
> Examples:
>  
> ||Expression||Result||
> |bitcount(0)|0|
> |bitcount(1)|1|
> |bitcount(39)|4|
> |bitcount(cast(x'ad') as BINARY(1)))|5|
> |bitcount(-1)|64|
>  
>  
> MySQL will handle decimal values as unsigned long values. For decimal values, 
> only the integer portion is examined.
>  
> ||Expression||Result||
> |bit_count(5.23)|2|
> |bit_count(18446744073709551615)|64|
> |bit_count(18446744073709551616)|63|
> |bit_count(18446744073709551617)|63|
> |bit_count(-9223372036854775808)|1|
> |bit_count(-9223372036854775809)|1|
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to