データ接続と統合Pipeline Builder の式Bit count

Bit count

サポート対象:バッチ、高速、ストリーミング

Counts the bits set in an integral or boolean value. Integral values are widened to longs first, so a negative value also counts its sign extension. True counts as 1 and false as 0.

式のカテゴリー: バイナリ

引数

  • Expression: The value whose set bits to count.
    Expression<Boolean | Byte | Integer | Long | Short>

出力タイプ: Integer

例

例1:基本ケース

説明: A negative integer counts the 32 extra bits of its sign extension to a long.

引数の値:

  • Expression: value
value出力
73
00
-164

例2:基本ケース

説明: A boolean counts as 1 if true and 0 if false.

引数の値:

  • Expression: value
value出力
true1
false0

例3:Null ケース

引数の値:

  • Expression: value
value出力
nullnull