[Groonga-commit] groonga/groonga at 19d82f9 [master] logical_select: support --limit

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 29 22:40:13 JST 2015


Kouhei Sutou	2015-06-29 22:40:13 +0900 (Mon, 29 Jun 2015)

  New Revision: 19d82f9fb98fb0ee1931df6cd8f10751ddd2ef05
  https://github.com/groonga/groonga/commit/19d82f9fb98fb0ee1931df6cd8f10751ddd2ef05

  Message:
    logical_select: support --limit

  Added files:
    test/command/suite/sharding/logical_select/limit/negative.test
    test/command/suite/sharding/logical_select/limit/positive.expected
    test/command/suite/sharding/logical_select/limit/positive.test
  Copied files:
    test/command/suite/sharding/logical_select/limit/negative.expected
      (from test/command/suite/sharding/logical_select/drilldown/plain/limit/positive.expected)
  Modified files:
    plugins/sharding/logical_select.rb
    test/command/suite/sharding/logical_select/drilldown/plain/keys/multiple.expected
    test/command/suite/sharding/logical_select/drilldown/plain/keys/single.expected
    test/command/suite/sharding/logical_select/drilldown/plain/limit/negative.expected
    test/command/suite/sharding/logical_select/drilldown/plain/limit/positive.expected
    test/command/suite/sharding/logical_select/drilldown/plain/offset/negative.expected
    test/command/suite/sharding/logical_select/drilldown/plain/offset/positive.expected
    test/command/suite/sharding/logical_select/drilldown/plain/sortby/ascending.expected
    test/command/suite/sharding/logical_select/drilldown/plain/sortby/descending.expected
    test/command/suite/sharding/logical_select/drilldown/plain/sortby/offset.expected
    test/command/suite/sharding/logical_select/drilldown/plain/sortby/offset_limit.expected
  Renamed files:
    test/command/suite/sharding/logical_select/drilldown/plain/sortby/limit.expected
      (from test/command/suite/sharding/logical_select/drilldown/plain/sortby/limit.actual)

  Modified: plugins/sharding/logical_select.rb (+10 -2)
===================================================================
--- plugins/sharding/logical_select.rb    2015-06-29 22:24:31 +0900 (ed868b2)
+++ plugins/sharding/logical_select.rb    2015-06-29 22:40:13 +0900 (c59dd35)
@@ -50,9 +50,17 @@ module Groonga
               if first_result_set
                 writer.write_table_columns(first_result_set, output_columns)
               end
-              options = {}
+
+              current_limit = context.limit
+              current_limit += n_hits + 1 if current_limit < 0
+              options = {
+                :limit => current_limit,
+              }
               result_sets.each do |result_set|
                 writer.write_table_records(result_set, output_columns, options)
+                current_limit -= result_set.size
+                break if current_limit <= 0
+                options[:limit] = current_limit
               end
             end
 
@@ -90,7 +98,7 @@ module Groonga
           @enumerator = LogicalEnumerator.new("logical_select", @input)
           @filter = @input[:filter]
           @offset = 0
-          @limit = 10
+          @limit = (@input[:limit] || 10).to_i
 
           @result_sets = []
 

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/keys/multiple.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/keys/multiple.expected    2015-06-29 22:24:31 +0900 (416feae)
+++ test/command/suite/sharding/logical_select/drilldown/plain/keys/multiple.expected    2015-06-29 22:40:13 +0900 (6d89464)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action,action,action
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/keys/single.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/keys/single.expected    2015-06-29 22:24:31 +0900 (bfd9673)
+++ test/command/suite/sharding/logical_select/drilldown/plain/keys/single.expected    2015-06-29 22:40:13 +0900 (03ab188)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/limit/negative.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/limit/negative.expected    2015-06-29 22:24:31 +0900 (5e3067f)
+++ test/command/suite/sharding/logical_select/drilldown/plain/limit/negative.expected    2015-06-29 22:40:13 +0900 (d842bc9)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_lim
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/limit/positive.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/limit/positive.expected    2015-06-29 22:24:31 +0900 (8b2a02d)
+++ test/command/suite/sharding/logical_select/drilldown/plain/limit/positive.expected    2015-06-29 22:40:13 +0900 (9ff6037)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_lim
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/offset/negative.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/offset/negative.expected    2015-06-29 22:24:31 +0900 (c00a66a)
+++ test/command/suite/sharding/logical_select/drilldown/plain/offset/negative.expected    2015-06-29 22:40:13 +0900 (03796d1)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_off
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/offset/positive.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/offset/positive.expected    2015-06-29 22:24:31 +0900 (deab61c)
+++ test/command/suite/sharding/logical_select/drilldown/plain/offset/positive.expected    2015-06-29 22:40:13 +0900 (c0cd88f)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_off
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/sortby/ascending.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/sortby/ascending.expected    2015-06-29 22:24:31 +0900 (f7958df)
+++ test/command/suite/sharding/logical_select/drilldown/plain/sortby/ascending.expected    2015-06-29 22:40:13 +0900 (d61fa64)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_sor
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/sortby/descending.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/sortby/descending.expected    2015-06-29 22:24:31 +0900 (d56bca0)
+++ test/command/suite/sharding/logical_select/drilldown/plain/sortby/descending.expected    2015-06-29 22:40:13 +0900 (8fe3c15)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_sor
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Renamed: test/command/suite/sharding/logical_select/drilldown/plain/sortby/limit.expected (+0 -45) 76%
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/sortby/limit.actual    2015-06-29 22:24:31 +0900 (ca68ed3)
+++ test/command/suite/sharding/logical_select/drilldown/plain/sortby/limit.expected    2015-06-29 22:40:13 +0900 (f8cb68a)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_sor
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/sortby/offset.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/sortby/offset.expected    2015-06-29 22:24:31 +0900 (b599db0)
+++ test/command/suite/sharding/logical_select/drilldown/plain/sortby/offset.expected    2015-06-29 22:40:13 +0900 (2f510bd)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_sor
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Modified: test/command/suite/sharding/logical_select/drilldown/plain/sortby/offset_limit.expected (+0 -45)
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/sortby/offset_limit.expected    2015-06-29 22:24:31 +0900 (181e138)
+++ test/command/suite/sharding/logical_select/drilldown/plain/sortby/offset_limit.expected    2015-06-29 22:40:13 +0900 (5fb792c)
@@ -106,51 +106,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_sor
           "timestamp",
           "Time"
         ]
-      ],
-      [
-        "Start",
-        "2015-02-03 12:49:00",
-        1422935340.0
-      ],
-      [
-        "Shutdown",
-        "2015-02-03 23:59:59",
-        1422975599.0
-      ],
-      [
-        "Start",
-        "2015-02-04 00:00:00",
-        1422975600.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:49:00",
-        1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
       ]
     ],
     [

  Copied: test/command/suite/sharding/logical_select/limit/negative.expected (+19 -74) 51%
===================================================================
--- test/command/suite/sharding/logical_select/drilldown/plain/limit/positive.expected    2015-06-29 22:24:31 +0900 (8b2a02d)
+++ test/command/suite/sharding/logical_select/limit/negative.expected    2015-06-29 22:40:13 +0900 (d46ccc2)
@@ -6,7 +6,9 @@ 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
+table_create Times_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
 [[0,0.0,0.0],true]
 table_create Logs_20150204 TABLE_NO_KEY
 [[0,0.0,0.0],true]
@@ -14,7 +16,9 @@ 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
+table_create Times_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
 [[0,0.0,0.0],true]
 table_create Logs_20150205 TABLE_NO_KEY
 [[0,0.0,0.0],true]
@@ -22,19 +26,19 @@ 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
+table_create Times_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 [[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"
+  "memo":      "2015-02-03 12:49:00"
 },
 {
   "timestamp": "2015-02-03 23:59:59",
-  "memo":      "2015-02-03 23:59:59",
-  "action":    "Shutdown"
+  "memo":      "2015-02-03 23:59:59"
 }
 ]
 [[0,0.0,0.0],2]
@@ -42,18 +46,15 @@ load --table Logs_20150204
 [
 {
   "timestamp": "2015-02-04 00:00:00",
-  "memo":      "2015-02-04 00:00:00",
-  "action":    "Start"
+  "memo":      "2015-02-04 00:00:00"
 },
 {
   "timestamp": "2015-02-04 13:49:00",
-  "memo":      "2015-02-04 13:49:00",
-  "action":    "Restart"
+  "memo":      "2015-02-04 13:49:00"
 },
 {
   "timestamp": "2015-02-04 13:50:00",
-  "memo":      "2015-02-04 13:50:00",
-  "action":    "Restart"
+  "memo":      "2015-02-04 13:50:00"
 }
 ]
 [[0,0.0,0.0],3]
@@ -61,27 +62,23 @@ load --table Logs_20150205
 [
 {
   "timestamp": "2015-02-05 13:49:00",
-  "memo":      "2015-02-05 13:49:00",
-  "action":    "Restart"
+  "memo":      "2015-02-05 13:49:00"
 },
 {
   "timestamp": "2015-02-05 13:50:00",
-  "memo":      "2015-02-05 13:50:00",
-  "action":    "Restart"
+  "memo":      "2015-02-05 13:50:00"
 },
 {
   "timestamp": "2015-02-05 13:51:00",
-  "memo":      "2015-02-05 13:51:00",
-  "action":    "Restart"
+  "memo":      "2015-02-05 13:51:00"
 },
 {
   "timestamp": "2015-02-05 13:52:00",
-  "memo":      "2015-02-05 13:52:00",
-  "action":    "Restart"
+  "memo":      "2015-02-05 13:52:00"
 }
 ]
 [[0,0.0,0.0],4]
-logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_limit 1
+logical_select Logs timestamp   --limit -6
 [
   [
     0,
@@ -95,10 +92,6 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_lim
       ],
       [
         [
-          "action",
-          "ShortText"
-        ],
-        [
           "memo",
           "ShortText"
         ],
@@ -108,68 +101,20 @@ logical_select Logs timestamp   --limit 0   --drilldown action   --drilldown_lim
         ]
       ],
       [
-        "Start",
         "2015-02-03 12:49:00",
         1422935340.0
       ],
       [
-        "Shutdown",
         "2015-02-03 23:59:59",
         1422975599.0
       ],
       [
-        "Start",
         "2015-02-04 00:00:00",
         1422975600.0
       ],
       [
-        "Restart",
         "2015-02-04 13:49:00",
         1423025340.0
-      ],
-      [
-        "Restart",
-        "2015-02-04 13:50:00",
-        1423025400.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:49:00",
-        1423111740.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:50:00",
-        1423111800.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:51:00",
-        1423111860.0
-      ],
-      [
-        "Restart",
-        "2015-02-05 13:52:00",
-        1423111920.0
-      ]
-    ],
-    [
-      [
-        3
-      ],
-      [
-        [
-          "_key",
-          "ShortText"
-        ],
-        [
-          "_nsubrecs",
-          "Int32"
-        ]
-      ],
-      [
-        "Start",
-        2
       ]
     ]
   ]

  Added: test/command/suite/sharding/logical_select/limit/negative.test (+72 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/limit/negative.test    2015-06-29 22:40:13 +0900 (649a429)
@@ -0,0 +1,72 @@
+#@on-error omit
+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
+table_create Times_20150203 TABLE_PAT_KEY Time
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+table_create Times_20150204 TABLE_PAT_KEY Time
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+table_create Times_20150205 TABLE_PAT_KEY Time
+column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00"
+}
+]
+
+logical_select Logs timestamp \
+  --limit -6

  Added: test/command/suite/sharding/logical_select/limit/positive.expected (+117 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/limit/positive.expected    2015-06-29 22:40:13 +0900 (2297945)
@@ -0,0 +1,117 @@
+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]
+table_create Times_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+[[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]
+table_create Times_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
+[[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]
+table_create Times_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59"
+}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00"
+}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00"
+}
+]
+[[0,0.0,0.0],4]
+logical_select Logs timestamp   --limit 3
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-03 12:49:00",
+        1422935340.0
+      ],
+      [
+        "2015-02-03 23:59:59",
+        1422975599.0
+      ],
+      [
+        "2015-02-04 00:00:00",
+        1422975600.0
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/sharding/logical_select/limit/positive.test (+72 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_select/limit/positive.test    2015-06-29 22:40:13 +0900 (1201c8c)
@@ -0,0 +1,72 @@
+#@on-error omit
+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
+table_create Times_20150203 TABLE_PAT_KEY Time
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 memo COLUMN_SCALAR ShortText
+table_create Times_20150204 TABLE_PAT_KEY Time
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+column_create Logs_20150205 memo COLUMN_SCALAR ShortText
+table_create Times_20150205 TABLE_PAT_KEY Time
+column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{
+  "timestamp": "2015-02-03 12:49:00",
+  "memo":      "2015-02-03 12:49:00"
+},
+{
+  "timestamp": "2015-02-03 23:59:59",
+  "memo":      "2015-02-03 23:59:59"
+}
+]
+
+load --table Logs_20150204
+[
+{
+  "timestamp": "2015-02-04 00:00:00",
+  "memo":      "2015-02-04 00:00:00"
+},
+{
+  "timestamp": "2015-02-04 13:49:00",
+  "memo":      "2015-02-04 13:49:00"
+},
+{
+  "timestamp": "2015-02-04 13:50:00",
+  "memo":      "2015-02-04 13:50:00"
+}
+]
+
+load --table Logs_20150205
+[
+{
+  "timestamp": "2015-02-05 13:49:00",
+  "memo":      "2015-02-05 13:49:00"
+},
+{
+  "timestamp": "2015-02-05 13:50:00",
+  "memo":      "2015-02-05 13:50:00"
+},
+{
+  "timestamp": "2015-02-05 13:51:00",
+  "memo":      "2015-02-05 13:51:00"
+},
+{
+  "timestamp": "2015-02-05 13:52:00",
+  "memo":      "2015-02-05 13:52:00"
+}
+]
+
+logical_select Logs timestamp \
+  --limit 3
-------------- next part --------------
HTML����������������������������...
Download 



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