Bitwise functions - Amazon Timestream
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Timestream for LiveAnalytics will no longer be open to new customers starting June 20, 2025. If you would like to use Amazon Timestream for LiveAnalytics, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see Amazon Timestream for LiveAnalytics availability change.

Bitwise functions

Timestream for LiveAnalytics supports the following bitwise functions.

Function Output data type Description

bit_count(bigint, bigint)

bigint (two's complement)

Returns the count of bits in the first bigint parameter where the second parameter is a bit signed integer such as 8 or 64.

SELECT bit_count(19, 8)

Example result: 3

SELECT bit_count(19, 2)

Example result: Number must be representable with the bits specified. 19 can not be represented with 2 bits

bitwise_and(bigint, bigint)

bigint (two's complement)

Returns the bitwise AND of the bigint parameters.

SELECT bitwise_and(12, 7)

Example result: 4

bitwise_not(bigint)

bigint (two's complement)

Returns the bitwise NOT of the bigint parameter.

SELECT bitwise_not(12)

Example result: -13

bitwise_or(bigint, bigint)

bigint (two's complement)

Returns the bitwise OR of the bigint parameters.

SELECT bitwise_or(12, 7)

Example result: 15

bitwise_xor(bigint, bigint)

bigint (two's complement)

Returns the bitwise XOR of the bigint parameters.

SELECT bitwise_xor(12, 7)

Example result: 11