Navigation Menu

Skip to content

Commit

Permalink
test drilldown clac: add tests for multiple keys
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 26, 2015
1 parent 4620f0b commit 66fe88f
Show file tree
Hide file tree
Showing 10 changed files with 689 additions and 0 deletions.
@@ -0,0 +1,128 @@
table_create Tags TABLE_PAT_KEY ShortText
[[0,0.0,0.0],true]
table_create Memos TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
column_create Memos tag COLUMN_SCALAR Tags
[[0,0.0,0.0],true]
column_create Memos user COLUMN_SCALAR ShortText
[[0,0.0,0.0],true]
column_create Memos priority COLUMN_SCALAR Int64
[[0,0.0,0.0],true]
load --table Memos
[
{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10},
{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20},
{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60},
{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61},
{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24},
{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8},
{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7},
{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3},
{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4},
{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1},
{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2},
{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3}
]
[[0,0.0,0.0],12]
select Memos --limit 0 --drilldown[tag].keys tag,user --drilldown[tag].calc_types 'AVG, MAX, MIN, SUM' --drilldown[tag].calc_target priority --drilldown[tag].output_columns _value.tag,_value.user,_max,_min,_sum,_avg
[
[
0,
0.0,
0.0
],
[
[
[
12
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"priority",
"Int64"
],
[
"tag",
"Tags"
],
[
"user",
"ShortText"
]
]
],
{
"tag": [
[
4
],
[
[
"tag",
"Tags"
],
[
"user",
"ShortText"
],
[
"_max",
"Int64"
],
[
"_min",
"Int64"
],
[
"_sum",
"Int64"
],
[
"_avg",
"Float"
]
],
[
"Groonga",
"user1",
60,
10,
90,
30.0
],
[
"Groonga",
"user2",
61,
8,
93,
31.0
],
[
"Mroonga",
"user3",
7,
-4,
6,
2.0
],
[
"Mroonga",
"user4",
-1,
-3,
-6,
-2.0
]
]
}
]
]
@@ -0,0 +1,29 @@
table_create Tags TABLE_PAT_KEY ShortText

table_create Memos TABLE_HASH_KEY ShortText
column_create Memos tag COLUMN_SCALAR Tags
column_create Memos user COLUMN_SCALAR ShortText
column_create Memos priority COLUMN_SCALAR Int64

load --table Memos
[
{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10},
{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20},
{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60},
{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61},
{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24},
{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8},
{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7},
{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3},
{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4},
{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1},
{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2},
{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3}
]

select Memos \
--limit 0 \
--drilldown[tag].keys tag,user \
--drilldown[tag].calc_types 'AVG, MAX, MIN, SUM' \
--drilldown[tag].calc_target priority \
--drilldown[tag].output_columns _value.tag,_value.user,_max,_min,_sum,_avg
@@ -0,0 +1,104 @@
table_create Tags TABLE_PAT_KEY ShortText
[[0,0.0,0.0],true]
table_create Memos TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
column_create Memos tag COLUMN_SCALAR Tags
[[0,0.0,0.0],true]
column_create Memos user COLUMN_SCALAR ShortText
[[0,0.0,0.0],true]
column_create Memos priority COLUMN_SCALAR Int64
[[0,0.0,0.0],true]
load --table Memos
[
{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10},
{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20},
{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60},
{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61},
{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24},
{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8},
{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7},
{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3},
{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4},
{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1},
{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2},
{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3}
]
[[0,0.0,0.0],12]
select Memos --limit 0 --drilldown[tag].keys tag,user --drilldown[tag].calc_types AVG --drilldown[tag].calc_target priority --drilldown[tag].output_columns _value.tag,_value.user,_avg
[
[
0,
0.0,
0.0
],
[
[
[
12
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"priority",
"Int64"
],
[
"tag",
"Tags"
],
[
"user",
"ShortText"
]
]
],
{
"tag": [
[
4
],
[
[
"tag",
"Tags"
],
[
"user",
"ShortText"
],
[
"_avg",
"Float"
]
],
[
"Groonga",
"user1",
30.0
],
[
"Groonga",
"user2",
31.0
],
[
"Mroonga",
"user3",
2.0
],
[
"Mroonga",
"user4",
-2.0
]
]
}
]
]
@@ -0,0 +1,29 @@
table_create Tags TABLE_PAT_KEY ShortText

table_create Memos TABLE_HASH_KEY ShortText
column_create Memos tag COLUMN_SCALAR Tags
column_create Memos user COLUMN_SCALAR ShortText
column_create Memos priority COLUMN_SCALAR Int64

load --table Memos
[
{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10},
{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20},
{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60},
{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61},
{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24},
{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8},
{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7},
{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3},
{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4},
{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1},
{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2},
{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3}
]

select Memos \
--limit 0 \
--drilldown[tag].keys tag,user \
--drilldown[tag].calc_types AVG \
--drilldown[tag].calc_target priority \
--drilldown[tag].output_columns _value.tag,_value.user,_avg
@@ -0,0 +1,104 @@
table_create Tags TABLE_PAT_KEY ShortText
[[0,0.0,0.0],true]
table_create Memos TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
column_create Memos tag COLUMN_SCALAR Tags
[[0,0.0,0.0],true]
column_create Memos user COLUMN_SCALAR ShortText
[[0,0.0,0.0],true]
column_create Memos priority COLUMN_SCALAR Int64
[[0,0.0,0.0],true]
load --table Memos
[
{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10},
{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20},
{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60},
{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61},
{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24},
{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8},
{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7},
{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3},
{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4},
{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1},
{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2},
{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3}
]
[[0,0.0,0.0],12]
select Memos --limit 0 --drilldown[tag].keys tag,user --drilldown[tag].calc_types MAX --drilldown[tag].calc_target priority --drilldown[tag].output_columns _value.tag,_value.user,_max
[
[
0,
0.0,
0.0
],
[
[
[
12
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"priority",
"Int64"
],
[
"tag",
"Tags"
],
[
"user",
"ShortText"
]
]
],
{
"tag": [
[
4
],
[
[
"tag",
"Tags"
],
[
"user",
"ShortText"
],
[
"_max",
"Int64"
]
],
[
"Groonga",
"user1",
60
],
[
"Groonga",
"user2",
61
],
[
"Mroonga",
"user3",
7
],
[
"Mroonga",
"user4",
-1
]
]
}
]
]

0 comments on commit 66fe88f

Please sign in to comment.