| |
| |
|
|
| |
| CREATE TABLE trade_source ( |
| trade_id BIGINT, |
| `type` INT, |
| `status` INT, |
| amount DOUBLE |
| ) WITH ( |
| 'connector' = 'datagen', |
| 'rows-per-second' = '3000', |
| 'fields.trade_id.kind' = 'random', |
| 'fields.trade_id.min' = '1', |
| 'fields.trade_id.max' = '1000000000', |
| 'fields.type.kind' = 'random', |
| 'fields.type.min' = '1', |
| 'fields.type.max' = '5', |
| 'fields.status.kind' = 'random', |
| 'fields.status.min' = '0', |
| 'fields.status.max' = '2', |
| 'fields.amount.kind' = 'random', |
| 'fields.amount.min' = '0', |
| 'fields.amount.max' = '5000' |
| ); |
|
|
| |
| CREATE TABLE console_output ( |
| `type` INT, |
| trade_cnt BIGINT, |
| total_amount DOUBLE |
| ) WITH ( |
| 'connector' = 'print' |
| ); |
|
|
| |
| INSERT INTO console_output |
| SELECT |
| `type`, |
| COUNT(*) AS trade_cnt, |
| SUM(amount) AS total_amount |
| FROM trade_source |
| WHERE `status` = 1 |
| GROUP BY `type`; |
|
|