You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2024/09/09 18:20:00 UTC

[jira] [Resolved] (CALCITE-3697) Implement BITCOUNT scalar function

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

Mihai Budiu resolved CALCITE-3697.
----------------------------------
    Fix Version/s: 1.38.0
       Resolution: Fixed

Fixed in https://github.com/apache/calcite/commit/67405c3892bcd2ccb03d14fff20471f4d6cd21a1
Thank you for the commit, [~njordan], and thanks to the many reviewers

> 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
>             Fix For: 1.38.0
>
>          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)