1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
plugin_register functions/time
[[0,0.0,0.0],true]
table_create Users TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
table_create Tags TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
table_create Reports TABLE_NO_KEY
[[0,0.0,0.0],true]
column_create Reports user COLUMN_SCALAR Users
[[0,0.0,0.0],true]
column_create Reports tag COLUMN_SCALAR Tags
[[0,0.0,0.0],true]
column_create Reports day COLUMN_SCALAR Time
[[0,0.0,0.0],true]
table_create Logs TABLE_NO_KEY
[[0,0.0,0.0],true]
column_create Logs user COLUMN_SCALAR Users
[[0,0.0,0.0],true]
column_create Logs tag COLUMN_SCALAR Tags
[[0,0.0,0.0],true]
column_create Logs time COLUMN_SCALAR Time
[[0,0.0,0.0],true]
load --table Reports
[
{"user": "alice", "tag": "tag1", "day": "2017-04-18 00:00:00"},
{"user": "alice", "tag": "tag1", "day": "2017-04-19 00:00:00"},
{"user": "david", "tag": "tag2", "day": "2017-04-20 00:00:00"},
{"user": "david", "tag": "tag3", "day": "2017-04-21 00:00:00"}
]
[[0,0.0,0.0],4]
load --table Logs
[
{"user": "alice", "tag": "tag1", "time": "2017-04-18 11:22:33"},
{"user": "alice", "tag": "tag1", "time": "2017-04-20 11:22:33"},
{"user": "bob", "tag": "tag1", "time": "2017-04-19 11:22:33"},
{"user": "david", "tag": "tag1", "time": "2017-04-19 11:22:33"},
{"user": "david", "tag": "tag2", "time": "2017-04-20 11:22:33"}
]
[[0,0.0,0.0],5]
select Logs --filter 'in_records(Reports, user, "==", "user", tag, "==", "tag", time_classify_day(time), "==", "day")'
[
[
0,
0.0,
0.0
],
[
[
[
2
],
[
[
"_id",
"UInt32"
],
[
"tag",
"Tags"
],
[
"time",
"Time"
],
[
"user",
"Users"
]
],
[
1,
"tag1",
1492482153.0,
"alice"
],
[
5,
"tag2",
1492654953.0,
"david"
]
]
]
]
|