ClickHouse/docs/zh/engines/table-engines/special/generate.md
Ivan Blinkov d91c97d15d
[docs] replace underscores with hyphens (#10606)
* Replace underscores with hyphens

* remove temporary code

* fix style check

* fix collapse
2020-04-30 21:19:18 +03:00

1.5 KiB

machine_translated machine_translated_rev toc_priority toc_title
true b111334d66 46 GenerateRandom

Generaterandom

GenerateRandom表引擎为给定的表架构生成随机数据。

使用示例:

  • 在测试中使用填充可重复的大表。
  • 为模糊测试生成随机输入。

在ClickHouse服务器中的使用

ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length)

max_array_lengthmax_string_length 参数指定所有的最大长度 数组列和字符串相应地在生成的数据中。

生成表引擎仅支持 SELECT 查询。

它支持所有 数据类型 可以存储在一个表中,除了 LowCardinalityAggregateFunction.

示例:

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 │
└──────┴────────────┘

实施细节

  • 不支持:
    • ALTER
    • SELECT ... SAMPLE
    • INSERT
    • 指数
    • 复制

原始文章