| 1 |
#@on-error omit |
| 2 |
plugin_register sharding |
| 3 |
#@on-error default |
| 4 |
|
| 5 |
table_create Items TABLE_HASH_KEY ShortText |
| 6 |
column_create Items price COLUMN_SCALAR UInt32 |
| 7 |
|
| 8 |
table_create Logs_20170415 TABLE_NO_KEY |
| 9 |
column_create Logs_20170415 timestamp COLUMN_SCALAR Time |
| 10 |
column_create Logs_20170415 item COLUMN_SCALAR Items |
| 11 |
column_create Logs_20170415 category COLUMN_SCALAR ShortText |
| 12 |
|
| 13 |
table_create Logs_20170416 TABLE_NO_KEY |
| 14 |
column_create Logs_20170416 timestamp COLUMN_SCALAR Time |
| 15 |
column_create Logs_20170416 item COLUMN_SCALAR Items |
| 16 |
column_create Logs_20170416 category COLUMN_SCALAR ShortText |
| 17 |
|
| 18 |
load --table Items |
| 19 |
[ |
| 20 |
{"_key": "item1", "price": 200}, |
| 21 |
{"_key": "item2", "price": 100} |
| 22 |
] |
| 23 |
|
| 24 |
load --table Logs_20170415 |
| 25 |
[ |
| 26 |
{"timestamp": "2017/04/15 00:00:00", "item": "item1", "category": "Book"}, |
| 27 |
{"timestamp": "2017/04/15 01:00:00", "item": "item2", "category": "Pen"}, |
| 28 |
{"timestamp": "2017/04/15 02:00:00", "item": "item1", "category": "Pen"} |
| 29 |
] |
| 30 |
|
| 31 |
load --table Logs_20170416 |
| 32 |
[ |
| 33 |
{"timestamp": "2017/04/16 10:00:00", "item": "item2", "category": "Pen"}, |
| 34 |
{"timestamp": "2017/04/16 11:00:00", "item": "item1", "category": "Pen"}, |
| 35 |
{"timestamp": "2017/04/16 12:00:00", "item": "item1", "category": "Book"} |
| 36 |
] |
| 37 |
|
| 38 |
|
| 39 |
logical_select Logs \ |
| 40 |
--shard_key timestamp \ |
| 41 |
--limit 0 \ |
| 42 |
--output_columns _id \ |
| 43 |
--drilldowns[group].keys item,category \ |
| 44 |
--drilldowns[group].columns[nth].stage initial \ |
| 45 |
--drilldowns[group].columns[nth].type UInt32 \ |
| 46 |
--drilldowns[group].columns[nth].flags COLUMN_SCALAR \ |
| 47 |
--drilldowns[group].columns[nth].value 'window_record_number()' \ |
| 48 |
--drilldowns[group].columns[nth].window.group_keys _value.item \ |
| 49 |
--drilldowns[group].output_columns _value.item,nth |
| 50 |
|
| 51 |
logical_select Logs \ |
| 52 |
--shard_key timestamp \ |
| 53 |
--limit 0 \ |
| 54 |
--output_columns _id \ |
| 55 |
--drilldowns[group].keys item,category \ |
| 56 |
--drilldowns[group].columns[nth].stage initial \ |
| 57 |
--drilldowns[group].columns[nth].type UInt32 \ |
| 58 |
--drilldowns[group].columns[nth].flags COLUMN_SCALAR \ |
| 59 |
--drilldowns[group].columns[nth].value 'window_record_number()' \ |
| 60 |
--drilldowns[group].columns[nth].window.group_keys _value.category \ |
| 61 |
--drilldowns[group].output_columns _value.item,nth |