| 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_20170315 TABLE_NO_KEY |
| 9 |
column_create Logs_20170315 timestamp COLUMN_SCALAR Time |
| 10 |
column_create Logs_20170315 items COLUMN_VECTOR Items |
| 11 |
|
| 12 |
table_create Logs_20170316 TABLE_NO_KEY |
| 13 |
column_create Logs_20170316 timestamp COLUMN_SCALAR Time |
| 14 |
column_create Logs_20170316 items COLUMN_VECTOR Items |
| 15 |
|
| 16 |
table_create Logs_20170317 TABLE_NO_KEY |
| 17 |
column_create Logs_20170317 timestamp COLUMN_SCALAR Time |
| 18 |
column_create Logs_20170317 items COLUMN_VECTOR Items |
| 19 |
|
| 20 |
load --table Items |
| 21 |
[ |
| 22 |
{"_key": "Book", "price": 1000}, |
| 23 |
{"_key": "Note", "price": 1000}, |
| 24 |
{"_key": "Box", "price": 500}, |
| 25 |
{"_key": "Pen", "price": 500}, |
| 26 |
{"_key": "Food", "price": 500}, |
| 27 |
{"_key": "Drink", "price": 300} |
| 28 |
] |
| 29 |
|
| 30 |
load --table Logs_20170315 |
| 31 |
[ |
| 32 |
{"timestamp": "2017/03/15 00:00:00", "items": ["Book", "Note", "Box", "Pen"]}, |
| 33 |
{"timestamp": "2017/03/15 01:00:00", "items": ["Food", "Drink", "Pen"]} |
| 34 |
] |
| 35 |
|
| 36 |
load --table Logs_20170316 |
| 37 |
[ |
| 38 |
{"timestamp": "2017/03/16 10:00:00", "items": ["Pen", "Note", "Food", "Drink"]}, |
| 39 |
{"timestamp": "2017/03/16 11:00:00", "items": ["Note", "Box"]} |
| 40 |
] |
| 41 |
|
| 42 |
load --table Logs_20170317 |
| 43 |
[ |
| 44 |
{"timestamp": "2017/03/17 20:00:00", "items": ["Food", "Book"]}, |
| 45 |
{"timestamp": "2017/03/17 20:00:00", "items": ["Drink", "Note"]} |
| 46 |
] |
| 47 |
|
| 48 |
logical_select Logs \ |
| 49 |
--shard_key timestamp \ |
| 50 |
--output_columns _id \ |
| 51 |
--limit 0 \ |
| 52 |
--drilldowns[item].keys items \ |
| 53 |
--drilldowns[item].sort_keys price \ |
| 54 |
--drilldowns[item].output_columns _key,_nsubrecs,price,price_with_tax \ |
| 55 |
--drilldowns[item].columns[price_with_tax].stage initial \ |
| 56 |
--drilldowns[item].columns[price_with_tax].type UInt32 \ |
| 57 |
--drilldowns[item].columns[price_with_tax].flags COLUMN_SCALAR \ |
| 58 |
--drilldowns[item].columns[price_with_tax].value 'price * 1.05' |
| 59 |
|
| 60 |
logical_select Logs \ |
| 61 |
--shard_key timestamp \ |
| 62 |
--output_columns _id \ |
| 63 |
--limit 0 \ |
| 64 |
--drilldowns[item].keys items \ |
| 65 |
--drilldowns[item].sort_keys price \ |
| 66 |
--drilldowns[item].output_columns _key,_nsubrecs,price,price_with_tax \ |
| 67 |
--drilldowns[item].columns[price_with_tax].stage initial \ |
| 68 |
--drilldowns[item].columns[price_with_tax].type UInt32 \ |
| 69 |
--drilldowns[item].columns[price_with_tax].flags COLUMN_SCALAR \ |
| 70 |
--drilldowns[item].columns[price_with_tax].value 'price * 1.08' |