[
https://issues.apache.org/jira/browse/FLINK-41018?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yuepeng Pan updated FLINK-41018:
--------------------------------
Description:
The {{BIT_COUNT}} built-in SQL function returns the number of bits that are set
to 1 in the binary representation of a given integer value. This operation is
also known as {*}popcount{*} (population count).
Key characteristics:
* It counts only the 1-bits; zero bits are ignored.
* The input must be an integer type (e.g., TINYINT, SMALLINT, INT, BIGINT).
* If the input is {{{}NULL{}}}, the result is {{{}NULL{}}}.
* For negative numbers, the function counts the 1-bits in the two's complement
representation of the value.
Common use cases include:
* Analyzing bitmask or flag fields (e.g., counting how many permissions are
enabled in a single integer column)
* Implementing Hamming distance calculations
* Working with bloom filters or hash-based data structures
* Approximate distinct counting in bitmap-based solutions
> Introduce BIT_COUNT as a built-in function for SQL and Table API
> ----------------------------------------------------------------
>
> Key: FLINK-41018
> URL: https://issues.apache.org/jira/browse/FLINK-41018
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / API
> Reporter: Yuepeng Pan
> Assignee: Yuepeng Pan
> Priority: Major
> Labels: pull-request-available
>
> The {{BIT_COUNT}} built-in SQL function returns the number of bits that are
> set to 1 in the binary representation of a given integer value. This
> operation is also known as {*}popcount{*} (population count).
> Key characteristics:
> * It counts only the 1-bits; zero bits are ignored.
> * The input must be an integer type (e.g., TINYINT, SMALLINT, INT, BIGINT).
> * If the input is {{{}NULL{}}}, the result is {{{}NULL{}}}.
> * For negative numbers, the function counts the 1-bits in the two's
> complement representation of the value.
> Common use cases include:
> * Analyzing bitmask or flag fields (e.g., counting how many permissions are
> enabled in a single integer column)
> * Implementing Hamming distance calculations
> * Working with bloom filters or hash-based data structures
> * Approximate distinct counting in bitmap-based solutions
--
This message was sent by Atlassian Jira
(v8.20.10#820010)