Debian Codegraph @

test/command/suite/sharding/logical_select/cache/drilldowns/columns/flags.test

raw
1 #@on-error omit
2 plugin_register sharding
3 #@on-error default
4
5 plugin_register functions/vector
6
7 table_create Items TABLE_HASH_KEY ShortText
8 column_create Items price COLUMN_SCALAR UInt32
9
10 table_create Logs_20170315 TABLE_NO_KEY
11 column_create Logs_20170315 timestamp COLUMN_SCALAR Time
12 column_create Logs_20170315 items COLUMN_VECTOR Items
13
14 table_create Logs_20170316 TABLE_NO_KEY
15 column_create Logs_20170316 timestamp COLUMN_SCALAR Time
16 column_create Logs_20170316 items COLUMN_VECTOR Items
17
18 table_create Logs_20170317 TABLE_NO_KEY
19 column_create Logs_20170317 timestamp COLUMN_SCALAR Time
20 column_create Logs_20170317 items COLUMN_VECTOR Items
21
22 load --table Items
23 [
24 {"_key": "Book", "price": 1000},
25 {"_key": "Note", "price": 1000},
26 {"_key": "Box", "price": 500},
27 {"_key": "Pen", "price": 500},
28 {"_key": "Food", "price": 500},
29 {"_key": "Drink", "price": 300}
30 ]
31
32 load --table Logs_20170315
33 [
34 {"timestamp": "2017/03/15 00:00:00", "items": ["Book", "Note", "Box", "Pen"]},
35 {"timestamp": "2017/03/15 01:00:00", "items": ["Food", "Drink", "Pen"]}
36 ]
37
38 load --table Logs_20170316
39 [
40 {"timestamp": "2017/03/16 10:00:00", "items": ["Pen", "Note", "Food", "Drink"]},
41 {"timestamp": "2017/03/16 11:00:00", "items": ["Note", "Box"]}
42 ]
43
44 load --table Logs_20170317
45 [
46 {"timestamp": "2017/03/17 20:00:00", "items": ["Food", "Book"]},
47 {"timestamp": "2017/03/17 20:00:00", "items": ["Drink", "Note"]}
48 ]
49
50 logical_select Logs \
51 --shard_key timestamp \
52 --output_columns _id \
53 --limit 0 \
54 --drilldowns[item].keys items \
55 --drilldowns[item].sort_keys price \
56 --drilldowns[item].columns[price_with_tax].stage initial \
57 --drilldowns[item].columns[price_with_tax].type ShortText \
58 --drilldowns[item].columns[price_with_tax].flags COLUMN_VECTOR \
59 --drilldowns[item].columns[price_with_tax].value 'vector_new()' \
60 --drilldowns[item].output_columns _key,price_with_tax
61
62 logical_select Logs \
63 --shard_key timestamp \
64 --output_columns _id \
65 --limit 0 \
66 --drilldowns[item].keys items \
67 --drilldowns[item].sort_keys price \
68 --drilldowns[item].columns[price_with_tax].stage initial \
69 --drilldowns[item].columns[price_with_tax].type ShortText \
70 --drilldowns[item].columns[price_with_tax].flags COLUMN_VECTOR|WITH_WEIGHT \
71 --drilldowns[item].columns[price_with_tax].value 'vector_new()' \
72 --drilldowns[item].output_columns _key,price_with_tax