ClickHouse/tests/queries/0_stateless/01066_bit_count.sql

20 lines
625 B
MySQL
Raw Normal View History

2020-01-17 19:57:03 +00:00
SELECT bitCount(number) FROM numbers(10);
SELECT avg(bitCount(number)) FROM numbers(256);
SELECT bitCount(0);
SELECT bitCount(1);
SELECT bitCount(-1);
SELECT bitCount(toInt64(-1));
SELECT bitCount(toInt32(-1));
SELECT bitCount(toInt16(-1));
SELECT bitCount(toInt8(-1));
SELECT x, bitCount(x), hex(reinterpretAsString(x)) FROM VALUES ('x Float64', (1), (-1), (inf));
2023-04-22 14:17:31 +00:00
SELECT toFixedString('Hello, world!!!!', 16) AS x, bitCount(x);
2023-04-23 11:31:23 +00:00
SELECT length(replaceAll(bin('clickhouse cloud'), '0', ''));
SELECT bitCount('clickhouse cloud');
SELECT length(replaceAll(bin('clickhouse cloud'), '0', '')) = bitCount('clickhouse cloud');