GenerateRandom 表引擎可根据给定的表 schema 生成随机数据。
用法示例:
- 用于测试中填充可复现的大型表。
- 为模糊测试生成随机输入。
在 ClickHouse Server 中使用
ENGINE = GenerateRandom([random_seed [,max_string_length [,max_array_length]]])max_array_length 和 max_string_length 参数分别指定生成数据中所有
数组或 map 列以及字符串的最大长度。
Generate 表引擎仅支持 SELECT 查询。
它支持除 AggregateFunction 之外所有可存储在表中的 数据类型。
示例
1. 创建 generate_engine_table 表:
CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3)2. 查询数据:
SELECT * FROM generate_engine_table LIMIT 3┌─name─┬──────value─┐
│ c4xJ │ 1412771199 │
│ r │ 1791099446 │
│ 7#$ │ 124312908 │
└──────┴────────────┘实现细节
- 不支持:
ALTERSELECT ... SAMPLEINSERT- 索引
- 复制