获取 ClickHouse 前 n 行的校验和 (cityHash64) table

Get checksum (cityHash64) of first n rows of ClickHouse table

根据https://clickhouse.tech/docs/en/sql-reference/functions/hash-functions/, 我可以通过这种方式获得整个 table 的校验和:

SELECT groupBitXor(cityHash64(*)) FROM table

获取 table 的前 N ​​行校验和的最准确方法是什么?

例如,我使用 table 和 GenerateRandom 引擎,如 here 所述。

CREATE TABLE test (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3)

我尝试使用 LIMIT 子句,但还没有成功。

考虑使用子查询:

SELECT groupBitXor(cityHash64(*)) 
FROM (
  SELECT *
  FROM table
  LIMIT x)

SELECT groupBitXor(cityHash64(*))
FROM 
(
    SELECT *
    FROM system.numbers
    LIMIT 10
)

/*
┌─groupBitXor(cityHash64(number))─┐
│             9791317254842948406 │
└─────────────────────────────────┘
*/