clickhouse-format does it better:
SELECT COUNT(*)
FROM table
;
SELECT *
FROM table
WHERE (frozen_rand >= 123) AND (frozen_rand <= 456)
ORDER BY RAND() ASC
LIMIT 1000
;
It also has the "obfuscate" option that is useful for test reports. clickhouse-format --obfuscate