Generate test data
The built-in load generator can generate mock data, which can be used in demos and tests. It provides an easy way to simulate the data stream without connecting to an actual external data source.
Use the SQL statement below to connect RisingWave to the built-in load generator.
Syntax
WITH
options - columnparameter
[]
The following table shows the data types that can be generated for each load generator type.
Generator \ Data | Number | Timestamp | Timestamptz | Varchar | Struct | Array |
---|---|---|---|---|---|---|
Sequence | ||||||
Random |
Select the type of data to be generated.
The sequence load generator can generate numbers, incremented by 1, from the starting number to the ending number. For example, 1
, 2
, 3
, … and 1.56
, 2.56
, 3.56
, …
Specify the following fields for every column.
column_parameter | Description | Value | Required? |
---|---|---|---|
kind | Generator type | Set to sequence. | FalseDefault: random |
start | Starting numberMust be smaller than the ending number. | Any number of the column data typeExample: 50 | FalseDefault: 0 |
end | Ending numberMust be larger than the starting number. | Any number of the column data typeExample: 100 | FalseDefault: 32767 |
Example
Here is an example of connecting RisingWave to the built-in load generator.
The following statement creates a source s1
with five columns:
i1
— An array of three integers starting from 1 and incrementing by 1v1
— Structs that contain random integersv2
ranging from -10 to 10 and random floating-point numbersv3
ranging from 15 to 55t1
— Random timestamps from as early as 2 hours as 37 minutes prior to the generator execution timez1
- Random timestamps with timezones from as early as 2 hours as 37 minutes prior to the generator execution timec1
— Random strings with each consists of 16 characters
Let’s query s1
after a few seconds.
Was this page helpful?