| 1 |
#@require-apache-arrow 3.0.0-SNAPSHOT |
| 2 |
|
| 3 |
#@on-error omit |
| 4 |
plugin_register sharding |
| 5 |
#@on-error default |
| 6 |
|
| 7 |
table_create Logs_20170415 TABLE_NO_KEY |
| 8 |
column_create Logs_20170415 timestamp COLUMN_SCALAR Time |
| 9 |
column_create Logs_20170415 price COLUMN_SCALAR UInt32 |
| 10 |
column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 |
| 11 |
|
| 12 |
table_create Logs_20170416 TABLE_NO_KEY |
| 13 |
column_create Logs_20170416 timestamp COLUMN_SCALAR Time |
| 14 |
column_create Logs_20170416 price COLUMN_SCALAR UInt32 |
| 15 |
column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 |
| 16 |
|
| 17 |
load --table Logs_20170415 |
| 18 |
[ |
| 19 |
{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, |
| 20 |
{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, |
| 21 |
{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} |
| 22 |
] |
| 23 |
|
| 24 |
load --table Logs_20170416 |
| 25 |
[ |
| 26 |
{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, |
| 27 |
{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, |
| 28 |
{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} |
| 29 |
] |
| 30 |
|
| 31 |
logical_select Logs \ |
| 32 |
--shard_key timestamp \ |
| 33 |
--columns[sum].stage initial \ |
| 34 |
--columns[sum].type UInt32 \ |
| 35 |
--columns[sum].flags COLUMN_SCALAR \ |
| 36 |
--columns[sum].value 'window_sum(price)' \ |
| 37 |
--columns[sum].window.group_keys n_likes \ |
| 38 |
--output_columns price,sum |
| 39 |
|
| 40 |
logical_select Logs \ |
| 41 |
--shard_key timestamp \ |
| 42 |
--columns[sum].stage initial \ |
| 43 |
--columns[sum].type UInt32 \ |
| 44 |
--columns[sum].flags COLUMN_SCALAR \ |
| 45 |
--columns[sum].value 'window_sum(price)' \ |
| 46 |
--columns[sum].window.group_keys price \ |
| 47 |
--output_columns price,sum |