Skip to content

Commit d14c2d5

Browse files
authored
[FLINK-37658][docs] Improve the Datagen connector docs
1 parent 3cfc211 commit d14c2d5

File tree

2 files changed

+42
-12
lines changed

2 files changed

+42
-12
lines changed

docs/content.zh/docs/connectors/table/datagen.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,21 @@ CREATE TABLE Orders (
9797
)
9898
```
9999

100+
对于集合类型,你可以指定集合的大小(元素个数)。
101+
102+
```sql
103+
CREATE TABLE Orders (
104+
f0 Array<INT>,
105+
f1 Map<INT, STRING>,
106+
f2 MULTISET<INT>
107+
) WITH (
108+
'connector' = 'datagen',
109+
'fields.f0.length' = '10',
110+
'fields.f1.length' = '11',
111+
'fields.f2.length' = '12'
112+
);
113+
```
114+
100115
字段类型
101116
-----
102117

@@ -285,21 +300,21 @@ CREATE TABLE Orders (
285300
<td>可选</td>
286301
<td style="word-wrap: break-word;">(Minimum value of type)</td>
287302
<td>(Type of field)</td>
288-
<td>随机生成器的最小值,适用于数字类型。</td>
303+
<td>随机生成器的最小值,仅适用于数字类型。</td>
289304
</tr>
290305
<tr>
291306
<td><h5>fields.#.max</h5></td>
292307
<td>可选</td>
293308
<td style="word-wrap: break-word;">(Maximum value of type)</td>
294309
<td>(Type of field)</td>
295-
<td>随机生成器的最大值,适用于数字类型。</td>
310+
<td>随机生成器的最大值,仅适用于数字类型。</td>
296311
</tr>
297312
<tr>
298313
<td><h5>fields.#.max-past</h5></td>
299314
<td>可选</td>
300315
<td style="word-wrap: break-word;">0</td>
301316
<td>Duration</td>
302-
<td>随机生成器生成相对当前时间向过去偏移的最大值,适用于 timestamp 类型。</td>
317+
<td>对于 string/bytes 类型为 100,对于 array/map/multiset 类型为 3。</td>
303318
</tr>
304319
<tr>
305320
<td><h5>fields.#.length</h5></td>
@@ -337,7 +352,7 @@ CREATE TABLE Orders (
337352
<tr>
338353
<td><h5>fields.#.null-rate</h5></td>
339354
<td>optional</td>
340-
<td style="word-wrap: break-word;">(none)</td>
355+
<td style="word-wrap: break-word;">0</td>
341356
<td>(Type of field)</td>
342357
<td>空值比例。</td>
343358
</tr>

docs/content/docs/connectors/table/datagen.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ CREATE TABLE Orders (
9999
)
100100
```
101101

102+
And for collections it is possible to specify different sized collections.
103+
104+
```sql
105+
CREATE TABLE Orders (
106+
f0 Array<INT>,
107+
f1 Map<INT, STRING>,
108+
f2 MULTISET<INT>
109+
) WITH (
110+
'connector' = 'datagen',
111+
'fields.f0.length' = '10',
112+
'fields.f1.length' = '11',
113+
'fields.f2.length' = '12'
114+
);
115+
```
116+
102117
Types
103118
-----
104119

@@ -289,14 +304,14 @@ Connector Options
289304
<td>optional</td>
290305
<td style="word-wrap: break-word;">(Minimum value of type)</td>
291306
<td>(Type of field)</td>
292-
<td>Minimum value of random generator, work for numeric types.</td>
307+
<td>Minimum value of random generator, only works for numeric types.</td>
293308
</tr>
294309
<tr>
295310
<td><h5>fields.#.max</h5></td>
296311
<td>optional</td>
297312
<td style="word-wrap: break-word;">(Maximum value of type)</td>
298313
<td>(Type of field)</td>
299-
<td>Maximum value of random generator, work for numeric types.</td>
314+
<td>Maximum value of random generator, only works for numeric types.</td>
300315
</tr>
301316
<tr>
302317
<td><h5>fields.#.max-past</h5></td>
@@ -308,21 +323,21 @@ Connector Options
308323
<tr>
309324
<td><h5>fields.#.length</h5></td>
310325
<td>optional</td>
311-
<td style="word-wrap: break-word;">100</td>
326+
<td style="word-wrap: break-word;">100 for string/bytes, 3 for array/map/multiset </td>
312327
<td>Integer</td>
313328
<td>
314329
Size or length of the collection for generating varchar/varbinary/string/bytes/array/map/multiset types.
315-
Please notice that for variable-length fields (varchar/varbinary), the default length is defined by the schema and cannot be set to a length greater than it.
316-
for super-long fields (string/bytes), the default length is 100 and can be set to a length less than 2^31.
317-
for constructed fields (array/map/multiset), the default number of elements is 3 and can be customized.
330+
Please note that for variable-length fields (varchar/varbinary), the default length is defined by the schema and cannot be set to a length greater than it.
331+
For super-long fields (string/bytes), the default length is 100 and can be set to a length less than 2^31.
332+
For constructed fields (array/map/multiset), the default number of elements is 3.
318333
</td>
319334
</tr>
320335
<tr>
321336
<td><h5>fields.#.var-len</h5></td>
322337
<td>optional</td>
323338
<td style="word-wrap: break-word;">false</td>
324339
<td>Boolean</td>
325-
<td>Whether to generate a variable-length data, please notice that it should only be used for variable-length types (varchar, string, varbinary, bytes).</td>
340+
<td>Whether to generate a variable-length data, only works for variable-length types (varchar, string, varbinary, bytes).</td>
326341
</tr>
327342
<tr>
328343
<td><h5>fields.#.start</h5></td>
@@ -341,7 +356,7 @@ Connector Options
341356
<tr>
342357
<td><h5>fields.#.null-rate</h5></td>
343358
<td>optional</td>
344-
<td style="word-wrap: break-word;">(none)</td>
359+
<td style="word-wrap: break-word;">0</td>
345360
<td>(Type of field)</td>
346361
<td>The proportion of null values.</td>
347362
</tr>

0 commit comments

Comments
 (0)