Kouhei Sutou
null+****@clear*****
Thu Jul 9 14:59:18 JST 2015
Kouhei Sutou 2015-07-09 14:59:18 +0900 (Thu, 09 Jul 2015) New Revision: fa93c9fe3c24c294b232924e043784392b53687c https://github.com/groonga/groonga/commit/fa93c9fe3c24c294b232924e043784392b53687c Message: logical_select: support calc_types and calc_target for labeled drilldown Added files: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/all.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/all.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/avg.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/avg.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/max.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/max.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/min.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/min.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/sum.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/sum.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/all.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/all.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/avg.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/avg.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/max.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/max.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/min.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/min.test test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/sum.expected test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/sum.test Modified files: plugins/sharding/logical_select.rb Modified: plugins/sharding/logical_select.rb (+1 -1) =================================================================== --- plugins/sharding/logical_select.rb 2015-07-09 12:19:53 +0900 (4d8a933) +++ plugins/sharding/logical_select.rb 2015-07-09 14:59:18 +0900 (153a52f) @@ -334,7 +334,7 @@ module Groonga def calc_target(table) return nil if @calc_target_name.nil? - table.column(@calc_target_name) + table.find_column(@calc_target_name) end def need_command_version2? Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/all.expected (+162 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/all.expected 2015-07-09 14:59:18 +0900 (5a81188) @@ -0,0 +1,162 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] +[[0,0.0,0.0],8] +logical_select Memos --shard_key created_at --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" + ], + [ + "created_at", + "Time" + ], + [ + "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 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/all.test (+57 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/all.test 2015-07-09 14:59:18 +0900 (631bdae) @@ -0,0 +1,57 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 user COLUMN_SCALAR ShortText +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 user COLUMN_SCALAR ShortText +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --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 Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/avg.expected (+138 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/avg.expected 2015-07-09 14:59:18 +0900 (89e9115) @@ -0,0 +1,138 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] +[[0,0.0,0.0],8] +logical_select Memos --shard_key created_at --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" + ], + [ + "created_at", + "Time" + ], + [ + "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 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/avg.test (+57 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/avg.test 2015-07-09 14:59:18 +0900 (465bcca) @@ -0,0 +1,57 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 user COLUMN_SCALAR ShortText +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 user COLUMN_SCALAR ShortText +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --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 Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/max.expected (+138 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/max.expected 2015-07-09 14:59:18 +0900 (e536de2) @@ -0,0 +1,138 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] +[[0,0.0,0.0],8] +logical_select Memos --shard_key created_at --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" + ], + [ + "created_at", + "Time" + ], + [ + "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 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/max.test (+57 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/max.test 2015-07-09 14:59:18 +0900 (22e96c1) @@ -0,0 +1,57 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 user COLUMN_SCALAR ShortText +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 user COLUMN_SCALAR ShortText +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --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 Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/min.expected (+138 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/min.expected 2015-07-09 14:59:18 +0900 (df78059) @@ -0,0 +1,138 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] +[[0,0.0,0.0],8] +logical_select Memos --shard_key created_at --limit 0 --drilldown[tag].keys tag,user --drilldown[tag].calc_types MIN --drilldown[tag].calc_target priority --drilldown[tag].output_columns _value.tag,_value.user,_min +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 12 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "created_at", + "Time" + ], + [ + "priority", + "Int64" + ], + [ + "tag", + "Tags" + ], + [ + "user", + "ShortText" + ] + ] + ], + { + "tag": [ + [ + 4 + ], + [ + [ + "tag", + "Tags" + ], + [ + "user", + "ShortText" + ], + [ + "_min", + "Int64" + ] + ], + [ + "Groonga", + "user1", + 10 + ], + [ + "Groonga", + "user2", + 8 + ], + [ + "Mroonga", + "user3", + -4 + ], + [ + "Mroonga", + "user4", + -3 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/min.test (+57 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/min.test 2015-07-09 14:59:18 +0900 (70f606a) @@ -0,0 +1,57 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 user COLUMN_SCALAR ShortText +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 user COLUMN_SCALAR ShortText +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --limit 0 \ + --drilldown[tag].keys tag,user \ + --drilldown[tag].calc_types MIN \ + --drilldown[tag].calc_target priority \ + --drilldown[tag].output_columns _value.tag,_value.user,_min Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/sum.expected (+138 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/sum.expected 2015-07-09 14:59:18 +0900 (934753a) @@ -0,0 +1,138 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 user COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] +[[0,0.0,0.0],8] +logical_select Memos --shard_key created_at --limit 0 --drilldown[tag].keys tag,user --drilldown[tag].calc_types SUM --drilldown[tag].calc_target priority --drilldown[tag].output_columns _value.tag,_value.user,_sum +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 12 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "created_at", + "Time" + ], + [ + "priority", + "Int64" + ], + [ + "tag", + "Tags" + ], + [ + "user", + "ShortText" + ] + ] + ], + { + "tag": [ + [ + 4 + ], + [ + [ + "tag", + "Tags" + ], + [ + "user", + "ShortText" + ], + [ + "_sum", + "Int64" + ] + ], + [ + "Groonga", + "user1", + 90 + ], + [ + "Groonga", + "user2", + 93 + ], + [ + "Mroonga", + "user3", + 6 + ], + [ + "Mroonga", + "user4", + -6 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/sum.test (+57 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/multiple/sum.test 2015-07-09 14:59:18 +0900 (e933659) @@ -0,0 +1,57 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 user COLUMN_SCALAR ShortText +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 user COLUMN_SCALAR ShortText +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "user": "user1", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "user": "user1", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "user": "user1", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Groonga4", "tag": "Groonga", "user": "user2", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Groonga5", "tag": "Groonga", "user": "user2", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Groonga6", "tag": "Groonga", "user": "user2", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "user": "user3", "priority": 7, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Mroonga2", "tag": "Mroonga", "user": "user3", "priority": 3, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "user": "user3", "priority": -4, + "created_at": "2015/07/10 04:00:00"}, +{"_key": "Mroonga4", "tag": "Mroonga", "user": "user4", "priority": -1, + "created_at": "2015/07/10 05:00:00"}, +{"_key": "Mroonga5", "tag": "Mroonga", "user": "user4", "priority": -2, + "created_at": "2015/07/10 06:00:00"}, +{"_key": "Mroonga6", "tag": "Mroonga", "user": "user4", "priority": -3, + "created_at": "2015/07/10 07:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --limit 0 \ + --drilldown[tag].keys tag,user \ + --drilldown[tag].calc_types SUM \ + --drilldown[tag].calc_target priority \ + --drilldown[tag].output_columns _value.tag,_value.user,_sum Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/all.expected (+133 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/all.expected 2015-07-09 14:59:18 +0900 (e4cf824) @@ -0,0 +1,133 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] +[[0,0.0,0.0],5] +logical_select Memos --shard_key created_at --limit 0 --drilldown[tag].keys tag --drilldown[tag].calc_types 'AVG, MAX, MIN, SUM' --drilldown[tag].calc_target priority --drilldown[tag].output_columns _key,_max,_min,_sum,_avg +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 9 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "created_at", + "Time" + ], + [ + "priority", + "Int64" + ], + [ + "tag", + "Tags" + ] + ] + ], + { + "tag": [ + [ + 3 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "_max", + "Int64" + ], + [ + "_min", + "Int64" + ], + [ + "_sum", + "Int64" + ], + [ + "_avg", + "Float" + ] + ], + [ + "Groonga", + 60, + 10, + 90, + 30.0 + ], + [ + "Mroonga", + 61, + 8, + 93, + 31.0 + ], + [ + "Rroonga", + 3, + -9, + -6, + -2.0 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/all.test (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/all.test 2015-07-09 14:59:18 +0900 (4b9047a) @@ -0,0 +1,49 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --limit 0 \ + --drilldown[tag].keys tag \ + --drilldown[tag].calc_types 'AVG, MAX, MIN, SUM' \ + --drilldown[tag].calc_target priority \ + --drilldown[tag].output_columns _key,_max,_min,_sum,_avg Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/avg.expected (+112 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/avg.expected 2015-07-09 14:59:18 +0900 (c862747) @@ -0,0 +1,112 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] +[[0,0.0,0.0],5] +logical_select Memos --shard_key created_at --limit 0 --drilldown[tag].keys tag --drilldown[tag].calc_types AVG --drilldown[tag].calc_target priority --drilldown[tag].output_columns _key,_avg +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 9 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "created_at", + "Time" + ], + [ + "priority", + "Int64" + ], + [ + "tag", + "Tags" + ] + ] + ], + { + "tag": [ + [ + 3 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "_avg", + "Float" + ] + ], + [ + "Groonga", + 30.0 + ], + [ + "Mroonga", + 31.0 + ], + [ + "Rroonga", + -2.0 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/avg.test (+50 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/avg.test 2015-07-09 14:59:18 +0900 (49de1cb) @@ -0,0 +1,50 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --limit 0 \ + --drilldown[tag].keys tag \ + --drilldown[tag].calc_types AVG \ + --drilldown[tag].calc_target priority \ + --drilldown[tag].output_columns _key,_avg + Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/max.expected (+112 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/max.expected 2015-07-09 14:59:18 +0900 (720914f) @@ -0,0 +1,112 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] +[[0,0.0,0.0],5] +logical_select Memos --shard_key created_at --limit 0 --drilldown[tag].keys tag --drilldown[tag].calc_types MAX --drilldown[tag].calc_target priority --drilldown[tag].output_columns _key,_max +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 9 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "created_at", + "Time" + ], + [ + "priority", + "Int64" + ], + [ + "tag", + "Tags" + ] + ] + ], + { + "tag": [ + [ + 3 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "_max", + "Int64" + ] + ], + [ + "Groonga", + 60 + ], + [ + "Mroonga", + 61 + ], + [ + "Rroonga", + 3 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/max.test (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/max.test 2015-07-09 14:59:18 +0900 (acb8d34) @@ -0,0 +1,49 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --limit 0 \ + --drilldown[tag].keys tag \ + --drilldown[tag].calc_types MAX \ + --drilldown[tag].calc_target priority \ + --drilldown[tag].output_columns _key,_max Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/min.expected (+112 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/min.expected 2015-07-09 14:59:18 +0900 (2f14988) @@ -0,0 +1,112 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] +[[0,0.0,0.0],5] +logical_select Memos --shard_key created_at --limit 0 --drilldown[tag].keys tag --drilldown[tag].calc_types MIN --drilldown[tag].calc_target priority --drilldown[tag].output_columns _key,_min +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 9 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "created_at", + "Time" + ], + [ + "priority", + "Int64" + ], + [ + "tag", + "Tags" + ] + ] + ], + { + "tag": [ + [ + 3 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "_min", + "Int64" + ] + ], + [ + "Groonga", + 10 + ], + [ + "Mroonga", + 8 + ], + [ + "Rroonga", + -9 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/min.test (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/min.test 2015-07-09 14:59:18 +0900 (940950c) @@ -0,0 +1,49 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --limit 0 \ + --drilldown[tag].keys tag \ + --drilldown[tag].calc_types MIN \ + --drilldown[tag].calc_target priority \ + --drilldown[tag].output_columns _key,_min Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/sum.expected (+112 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/sum.expected 2015-07-09 14:59:18 +0900 (5fe651f) @@ -0,0 +1,112 @@ +register sharding +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Memos_20150709 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150709 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150709 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150709 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +table_create Memos_20150710 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos_20150710 created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Memos_20150710 tag COLUMN_SCALAR Tags +[[0,0.0,0.0],true] +column_create Memos_20150710 priority COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] +[[0,0.0,0.0],4] +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] +[[0,0.0,0.0],5] +logical_select Memos --shard_key created_at --limit 0 --drilldown[tag].keys tag --drilldown[tag].calc_types SUM --drilldown[tag].calc_target priority --drilldown[tag].output_columns _key,_sum +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 9 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "created_at", + "Time" + ], + [ + "priority", + "Int64" + ], + [ + "tag", + "Tags" + ] + ] + ], + { + "tag": [ + [ + 3 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "_sum", + "Int64" + ] + ], + [ + "Groonga", + 90 + ], + [ + "Mroonga", + 93 + ], + [ + "Rroonga", + -6 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/sum.test (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldown/labeled/calc_types/single/sum.test 2015-07-09 14:59:18 +0900 (eae6812) @@ -0,0 +1,49 @@ +#@on-error omit +register sharding +#@on-error default + +table_create Tags TABLE_PAT_KEY ShortText + +table_create Memos_20150709 TABLE_HASH_KEY ShortText +column_create Memos_20150709 created_at COLUMN_SCALAR Time +column_create Memos_20150709 tag COLUMN_SCALAR Tags +column_create Memos_20150709 priority COLUMN_SCALAR Int64 + +table_create Memos_20150710 TABLE_HASH_KEY ShortText +column_create Memos_20150710 created_at COLUMN_SCALAR Time +column_create Memos_20150710 tag COLUMN_SCALAR Tags +column_create Memos_20150710 priority COLUMN_SCALAR Int64 + +load --table Memos_20150709 +[ +{"_key": "Groonga1", "tag": "Groonga", "priority": 10, + "created_at": "2015/07/09 00:00:00"}, +{"_key": "Groonga2", "tag": "Groonga", "priority": 20, + "created_at": "2015/07/09 01:00:00"}, +{"_key": "Groonga3", "tag": "Groonga", "priority": 60, + "created_at": "2015/07/09 02:00:00"}, +{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61, + "created_at": "2015/07/09 03:00:00"} +] + +load --table Memos_20150710 +[ +{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24, + "created_at": "2015/07/10 00:00:00"}, +{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8, + "created_at": "2015/07/10 01:00:00"}, +{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3, + "created_at": "2015/07/10 02:00:00"}, +{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9, + "created_at": "2015/07/10 03:00:00"}, +{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0, + "created_at": "2015/07/10 04:00:00"} +] + +logical_select Memos \ + --shard_key created_at \ + --limit 0 \ + --drilldown[tag].keys tag \ + --drilldown[tag].calc_types SUM \ + --drilldown[tag].calc_target priority \ + --drilldown[tag].output_columns _key,_sum