[Groonga-commit] groonga/groonga at 085ec28 [master] logical_select: rename drilldown[LABEL] to drilldowns[LABEL]

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jan 17 20:01:03 JST 2017


Kouhei Sutou	2017-01-17 20:01:03 +0900 (Tue, 17 Jan 2017)

  New Revision: 085ec2826d05892d8a51ad775ee3d63931e2d7f6
  https://github.com/groonga/groonga/commit/085ec2826d05892d8a51ad775ee3d63931e2d7f6

  Message:
    logical_select: rename drilldown[LABEL] to drilldowns[LABEL]
    
    drilldown[LABEL] is still available but it's deprecated. Don't use it in
    newly written code.

  Added files:
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/all.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/all.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/avg.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/avg.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/max.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/max.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/min.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/min.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/sum.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/sum.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/all.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/all.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/avg.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/avg.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/max.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/max.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/min.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/min.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/sum.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/sum.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/keys/multiple.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/keys/multiple.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/keys/one.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/keys/one.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/limit/negative.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/limit/negative.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/limit/positive.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/limit/positive.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/offset/negative.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/offset/negative.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/offset/positive.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/offset/positive.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/output_columns/multiple/value_v1.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/output_columns/multiple/value_v1.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/ascending.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/ascending.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/descending.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/descending.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/limit.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/limit.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/multiple/one_shard.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/multiple/one_shard.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset.test
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset_limit.expected
    test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset_limit.test
  Modified files:
    plugins/sharding/logical_select.rb

  Modified: plugins/sharding/logical_select.rb (+1 -1)
===================================================================
--- plugins/sharding/logical_select.rb    2017-01-17 11:16:53 +0900 (409e9ab)
+++ plugins/sharding/logical_select.rb    2017-01-17 20:01:03 +0900 (cc2b954)
@@ -332,7 +332,7 @@ module Groonga
             arguments.each do |argument_id|
               argument.id = argument_id
               key = argument.key
-              match_data = /\Adrilldown\[(.+?)\]\.(.+)\z/.match(key)
+              match_data = /\Adrilldowns?\[(.+?)\]\.(.+)\z/.match(key)
               next if match_data.nil?
               drilldown = (drilldowns[match_data[1]] ||= {})
               drilldown[match_data[2]] = input[key]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/all.expected (+162 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/all.expected    2017-01-17 20:01:03 +0900 (3fa5eef)
@@ -0,0 +1,162 @@
+plugin_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   --drilldowns[tag].keys tag,user   --drilldowns[tag].calc_types 'AVG, MAX, MIN, SUM'   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/multiple/all.test (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/all.test    2017-01-17 20:01:03 +0900 (2749663)
@@ -0,0 +1,57 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag,user \
+  --drilldowns[tag].calc_types 'AVG, MAX, MIN, SUM' \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _value.tag,_value.user,_max,_min,_sum,_avg

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/avg.expected (+138 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/avg.expected    2017-01-17 20:01:03 +0900 (64c9fd7)
@@ -0,0 +1,138 @@
+plugin_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   --drilldowns[tag].keys tag,user   --drilldowns[tag].calc_types AVG   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/multiple/avg.test (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/avg.test    2017-01-17 20:01:03 +0900 (dd297f1)
@@ -0,0 +1,57 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag,user \
+  --drilldowns[tag].calc_types AVG \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _value.tag,_value.user,_avg

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/max.expected (+138 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/max.expected    2017-01-17 20:01:03 +0900 (518a6d3)
@@ -0,0 +1,138 @@
+plugin_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   --drilldowns[tag].keys tag,user   --drilldowns[tag].calc_types MAX   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/multiple/max.test (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/max.test    2017-01-17 20:01:03 +0900 (833ac68)
@@ -0,0 +1,57 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag,user \
+  --drilldowns[tag].calc_types MAX \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _value.tag,_value.user,_max

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/min.expected (+138 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/min.expected    2017-01-17 20:01:03 +0900 (384d7f7)
@@ -0,0 +1,138 @@
+plugin_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   --drilldowns[tag].keys tag,user   --drilldowns[tag].calc_types MIN   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/multiple/min.test (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/min.test    2017-01-17 20:01:03 +0900 (cd0e035)
@@ -0,0 +1,57 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag,user \
+  --drilldowns[tag].calc_types MIN \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _value.tag,_value.user,_min

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/sum.expected (+138 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/sum.expected    2017-01-17 20:01:03 +0900 (6c1c7ce)
@@ -0,0 +1,138 @@
+plugin_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   --drilldowns[tag].keys tag,user   --drilldowns[tag].calc_types SUM   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/multiple/sum.test (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/multiple/sum.test    2017-01-17 20:01:03 +0900 (1df9235)
@@ -0,0 +1,57 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag,user \
+  --drilldowns[tag].calc_types SUM \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _value.tag,_value.user,_sum

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/all.expected (+133 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/all.expected    2017-01-17 20:01:03 +0900 (95af370)
@@ -0,0 +1,133 @@
+plugin_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   --drilldowns[tag].keys tag   --drilldowns[tag].calc_types 'AVG, MAX, MIN, SUM'   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/single/all.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/all.test    2017-01-17 20:01:03 +0900 (15d9c0a)
@@ -0,0 +1,49 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag \
+  --drilldowns[tag].calc_types 'AVG, MAX, MIN, SUM' \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _key,_max,_min,_sum,_avg

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/avg.expected (+112 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/avg.expected    2017-01-17 20:01:03 +0900 (d05531d)
@@ -0,0 +1,112 @@
+plugin_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   --drilldowns[tag].keys tag   --drilldowns[tag].calc_types AVG   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/single/avg.test (+50 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/avg.test    2017-01-17 20:01:03 +0900 (5872203)
@@ -0,0 +1,50 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag \
+  --drilldowns[tag].calc_types AVG \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _key,_avg
+

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/max.expected (+112 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/max.expected    2017-01-17 20:01:03 +0900 (4e77c0a)
@@ -0,0 +1,112 @@
+plugin_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   --drilldowns[tag].keys tag   --drilldowns[tag].calc_types MAX   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/single/max.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/max.test    2017-01-17 20:01:03 +0900 (0875c21)
@@ -0,0 +1,49 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag \
+  --drilldowns[tag].calc_types MAX \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _key,_max

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/min.expected (+112 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/min.expected    2017-01-17 20:01:03 +0900 (4b2f872)
@@ -0,0 +1,112 @@
+plugin_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   --drilldowns[tag].keys tag   --drilldowns[tag].calc_types MIN   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/single/min.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/min.test    2017-01-17 20:01:03 +0900 (dc4627e)
@@ -0,0 +1,49 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag \
+  --drilldowns[tag].calc_types MIN \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _key,_min

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/sum.expected (+112 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/sum.expected    2017-01-17 20:01:03 +0900 (464431c)
@@ -0,0 +1,112 @@
+plugin_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   --drilldowns[tag].keys tag   --drilldowns[tag].calc_types SUM   --drilldowns[tag].calc_target priority   --drilldowns[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/drilldowns/labeled/calc_types/single/sum.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/calc_types/single/sum.test    2017-01-17 20:01:03 +0900 (99ab97e)
@@ -0,0 +1,49 @@
+#@on-error omit
+plugin_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 \
+  --drilldowns[tag].keys tag \
+  --drilldowns[tag].calc_types SUM \
+  --drilldowns[tag].calc_target priority \
+  --drilldowns[tag].output_columns _key,_sum

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/keys/multiple.expected (+181 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/keys/multiple.expected    2017-01-17 20:01:03 +0900 (a001fb7)
@@ -0,0 +1,181 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _key[0],_key[1],_nsubrecs
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "_key[0]",
+            null
+          ],
+          [
+            "_key[1]",
+            null
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Start",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Shutdown",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Start",
+          "2015-02-04",
+          1
+        ],
+        [
+          "Restart",
+          "2015-02-04",
+          2
+        ],
+        [
+          "Restart",
+          "2015-02-05",
+          4
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/keys/multiple.test (+92 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/keys/multiple.test    2017-01-17 20:01:03 +0900 (64e6d71)
@@ -0,0 +1,92 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _key[0],_key[1],_nsubrecs

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/keys/one.expected (+145 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/keys/one.expected    2017-01-17 20:01:03 +0900 (9c970f5)
@@ -0,0 +1,145 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action].keys action
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action": [
+        [
+          3
+        ],
+        [
+          [
+            "_key",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Start",
+          2
+        ],
+        [
+          "Shutdown",
+          1
+        ],
+        [
+          "Restart",
+          6
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/keys/one.test (+79 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/keys/one.test    2017-01-17 20:01:03 +0900 (711dd5d)
@@ -0,0 +1,79 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action].keys action

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/limit/negative.expected (+176 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/limit/negative.expected    2017-01-17 20:01:03 +0900 (d44bc28)
@@ -0,0 +1,176 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].limit -2
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Start",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Shutdown",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Start",
+          "2015-02-04",
+          1
+        ],
+        [
+          "Restart",
+          "2015-02-04",
+          2
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/limit/negative.test (+93 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/limit/negative.test    2017-01-17 20:01:03 +0900 (d097dc9)
@@ -0,0 +1,93 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].limit -2

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/limit/positive.expected (+161 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/limit/positive.expected    2017-01-17 20:01:03 +0900 (9f4d8a5)
@@ -0,0 +1,161 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].limit 1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Start",
+          "2015-02-03",
+          1
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/limit/positive.test (+93 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/limit/positive.test    2017-01-17 20:01:03 +0900 (3a91af8)
@@ -0,0 +1,93 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].limit 1

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/offset/negative.expected (+161 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/offset/negative.expected    2017-01-17 20:01:03 +0900 (f1b592e)
@@ -0,0 +1,161 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].offset -1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Restart",
+          "2015-02-05",
+          4
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/offset/negative.test (+93 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/offset/negative.test    2017-01-17 20:01:03 +0900 (5d19ef9)
@@ -0,0 +1,93 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].offset -1

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/offset/positive.expected (+176 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/offset/positive.expected    2017-01-17 20:01:03 +0900 (d55ffe1)
@@ -0,0 +1,176 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].offset 1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Shutdown",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Start",
+          "2015-02-04",
+          1
+        ],
+        [
+          "Restart",
+          "2015-02-04",
+          2
+        ],
+        [
+          "Restart",
+          "2015-02-05",
+          4
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/offset/positive.test (+93 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/offset/positive.test    2017-01-17 20:01:03 +0900 (48ae003)
@@ -0,0 +1,93 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].offset 1

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/output_columns/multiple/value_v1.expected (+181 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/output_columns/multiple/value_v1.expected    2017-01-17 20:01:03 +0900 (a8e9bbc)
@@ -0,0 +1,181 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Start",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Shutdown",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Start",
+          "2015-02-04",
+          1
+        ],
+        [
+          "Restart",
+          "2015-02-04",
+          2
+        ],
+        [
+          "Restart",
+          "2015-02-05",
+          4
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/output_columns/multiple/value_v1.test (+92 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/output_columns/multiple/value_v1.test    2017-01-17 20:01:03 +0900 (3ed527c)
@@ -0,0 +1,92 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/ascending.expected (+181 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/ascending.expected    2017-01-17 20:01:03 +0900 (cda0ecd)
@@ -0,0 +1,181 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].sortby _nsubrecs
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Start",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Shutdown",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Start",
+          "2015-02-04",
+          1
+        ],
+        [
+          "Restart",
+          "2015-02-04",
+          2
+        ],
+        [
+          "Restart",
+          "2015-02-05",
+          4
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/ascending.test (+93 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/ascending.test    2017-01-17 20:01:03 +0900 (237ba91)
@@ -0,0 +1,93 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].sortby _nsubrecs

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/descending.expected (+181 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/descending.expected    2017-01-17 20:01:03 +0900 (2e37933)
@@ -0,0 +1,181 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].sortby -_nsubrecs
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Restart",
+          "2015-02-05",
+          4
+        ],
+        [
+          "Restart",
+          "2015-02-04",
+          2
+        ],
+        [
+          "Start",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Start",
+          "2015-02-04",
+          1
+        ],
+        [
+          "Shutdown",
+          "2015-02-03",
+          1
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/descending.test (+93 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/descending.test    2017-01-17 20:01:03 +0900 (c41cfea)
@@ -0,0 +1,93 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].sortby -_nsubrecs

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/limit.expected (+161 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/limit.expected    2017-01-17 20:01:03 +0900 (406225d)
@@ -0,0 +1,161 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].sortby _nsubrecs   --drilldowns[action_date].limit 1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Start",
+          "2015-02-03",
+          1
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/limit.test (+94 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/limit.test    2017-01-17 20:01:03 +0900 (776d386)
@@ -0,0 +1,94 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].sortby _nsubrecs \
+  --drilldowns[action_date].limit 1

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/multiple/one_shard.expected (+177 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/multiple/one_shard.expected    2017-01-17 20:01:03 +0900 (bdd805b)
@@ -0,0 +1,177 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+},
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:53:00",
+  "memo":      "2015-02-05 13:53:00",
+  "date":      "2015-02-05",
+  "action":    "Shutdown"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Shutdown"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],5]
+logical_select Logs timestamp   --min "2015-02-05 00:00:00"   --min_border "include"   --max "2015-02-06 00:00:00"   --max_border "exclude"   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].sortby -_nsubrecs,_value.date,_value.action
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        5
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          3
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Restart",
+          "2015-02-05",
+          2
+        ],
+        [
+          "Shutdown",
+          "2015-02-05",
+          2
+        ],
+        [
+          "Start",
+          "2015-02-05",
+          1
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/multiple/one_shard.test (+103 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/multiple/one_shard.test    2017-01-17 20:01:03 +0900 (a78201f)
@@ -0,0 +1,103 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+},
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:53:00",
+  "memo":      "2015-02-05 13:53:00",
+  "date":      "2015-02-05",
+  "action":    "Shutdown"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Shutdown"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --min "2015-02-05 00:00:00" \
+  --min_border "include" \
+  --max "2015-02-06 00:00:00" \
+  --max_border "exclude" \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].sortby -_nsubrecs,_value.date,_value.action

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset.expected (+176 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset.expected    2017-01-17 20:01:03 +0900 (357595e)
@@ -0,0 +1,176 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].sortby _nsubrecs   --drilldowns[action_date].offset 1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Shutdown",
+          "2015-02-03",
+          1
+        ],
+        [
+          "Start",
+          "2015-02-04",
+          1
+        ],
+        [
+          "Restart",
+          "2015-02-04",
+          2
+        ],
+        [
+          "Restart",
+          "2015-02-05",
+          4
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset.test (+94 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset.test    2017-01-17 20:01:03 +0900 (3b30674)
@@ -0,0 +1,94 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].sortby _nsubrecs \
+  --drilldowns[action_date].offset 1

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset_limit.expected (+161 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset_limit.expected    2017-01-17 20:01:03 +0900 (03f7744)
@@ -0,0 +1,161 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20150203 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150204 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Logs_20150205 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 0   --drilldowns[action_date].keys action,date   --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs   --drilldowns[action_date].sortby _nsubrecs   --drilldowns[action_date].offset 1   --drilldowns[action_date].limit 1
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "action",
+          "ShortText"
+        ],
+        [
+          "date",
+          "ShortText"
+        ],
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ]
+    ],
+    {
+      "action_date": [
+        [
+          5
+        ],
+        [
+          [
+            "action",
+            "ShortText"
+          ],
+          [
+            "date",
+            "ShortText"
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Shutdown",
+          "2015-02-03",
+          1
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset_limit.test (+95 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/drilldowns/labeled/sortby/offset_limit.test    2017-01-17 20:01:03 +0900 (8fcbe4f)
@@ -0,0 +1,95 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 memo COLUMN_SCALAR ShortText
+column_create Logs_20150203 date COLUMN_SCALAR ShortText
+column_create Logs_20150203 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+column_create Logs_20150204 date COLUMN_SCALAR ShortText
+column_create Logs_20150204 action COLUMN_SCALAR ShortText
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+column_create Logs_20150205 date COLUMN_SCALAR ShortText
+column_create Logs_20150205 action COLUMN_SCALAR ShortText
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00",
+  "date":      "2015-02-03",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59",
+  "date":      "2015-02-03",
+  "action":    "Shutdown"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00",
+  "date":      "2015-02-04",
+  "action":    "Start"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00",
+  "date":      "2015-02-04",
+  "action":    "Restart"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00",
+  "date":      "2015-02-05",
+  "action":    "Restart"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 0 \
+  --drilldowns[action_date].keys action,date \
+  --drilldowns[action_date].output_columns _value.action,_value.date,_nsubrecs \
+  --drilldowns[action_date].sortby _nsubrecs \
+  --drilldowns[action_date].offset 1 \
+  --drilldowns[action_date].limit 1




More information about the Groonga-commit mailing list
Back to archive index