[Groonga-commit] groonga/groonga at 0042f27 [master] logical_count: support counting by index

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Feb 5 13:04:55 JST 2015


Kouhei Sutou	2015-02-05 13:04:55 +0900 (Thu, 05 Feb 2015)

  New Revision: 0042f270b59b7832fb14dc2c5eae366825da45fa
  https://github.com/groonga/groonga/commit/0042f270b59b7832fb14dc2c5eae366825da45fa

  Message:
    logical_count: support counting by index

  Added files:
    test/command/suite/sharding/logical_count/no_condition/range/index/max_exclude.expected
    test/command/suite/sharding/logical_count/no_condition/range/index/max_exclude.test
    test/command/suite/sharding/logical_count/no_condition/range/index/max_include.expected
    test/command/suite/sharding/logical_count/no_condition/range/index/max_include.test
    test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude.expected
    test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude.test
    test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_exclude.expected
    test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_exclude.test
    test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_include.expected
    test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_include.test
    test/command/suite/sharding/logical_count/no_condition/range/index/min_include.expected
    test/command/suite/sharding/logical_count/no_condition/range/index/min_include.test
    test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_exclude.expected
    test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_exclude.test
    test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_include.expected
    test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_include.test
  Modified files:
    plugins/sharding/search.rb

  Modified: plugins/sharding/search.rb (+66 -3)
===================================================================
--- plugins/sharding/search.rb    2015-02-05 12:57:16 +0900 (60c759b)
+++ plugins/sharding/search.rb    2015-02-05 13:04:55 +0900 (3f71a7a)
@@ -57,14 +57,32 @@ module Groonga
         cover_type = target_range.cover_type(shard_range)
         case cover_type
         when :none
-          0
+          return 0
         when :all
           if filter.nil?
-            table.size
+            return table.size
           else
-            filtered_count_n_records(table, filter)
+            return filtered_count_n_records(table, filter)
           end
+        end
+
+        use_range_index = false
+        range_index = nil
+        if filter.nil?
+          index_info = shard_key.find_index(Operator::LESS)
+          if index_info
+            range_index = index_info.index
+            use_range_index = true
+          end
+        end
+
+        case cover_type
         when :partial_min
+          if use_range_index
+            count_n_records_in_range(range_index,
+                                     target_range.min, target_range.min_border,
+                                     nil, nil)
+          else
           filtered_count_n_records(table, filter) do |expression|
             expression.append_object(shard_key, Operator::PUSH, 1)
             expression.append_operator(Operator::GET_VALUE, 1)
@@ -75,7 +93,13 @@ module Groonga
               expression.append_operator(Operator::GREATER, 2)
             end
           end
+          end
         when :partial_max
+          if use_range_index
+            count_n_records_in_range(range_index,
+                                     nil, nil,
+                                     target_range.max, target_range.max_border)
+          else
           filtered_count_n_records(table, filter) do |expression|
             expression.append_object(shard_key, Operator::PUSH, 1)
             expression.append_operator(Operator::GET_VALUE, 1)
@@ -86,7 +110,13 @@ module Groonga
               expression.append_operator(Operator::LESS, 2)
             end
           end
+          end
         when :partial_min_and_max
+          if use_range_index
+            count_n_records_in_range(range_index,
+                                     target_range.min, target_range.min_border,
+                                     target_range.max, target_range.max_border)
+          else
           filtered_count_n_records(table, filter) do |expression|
             expression.append_object(context["between"], Operator::PUSH, 1)
             expression.append_object(shard_key, Operator::PUSH, 1)
@@ -99,6 +129,7 @@ module Groonga
                                        Operator::PUSH, 1)
             expression.append_operator(Operator::CALL, 5)
           end
+          end
         end
       end
 
@@ -125,6 +156,38 @@ module Groonga
         end
       end
 
+      def count_n_records_in_range(range_index,
+                                   min, min_border, max, max_border)
+        flags = TableCursorFlags::BY_KEY
+        case min_border
+        when :include
+          flags |= TableCursorFlags::GE
+        when :exclude
+          flags |= TableCursorFlags::GT
+        end
+        case max_border
+        when :include
+          flags |= TableCursorFlags::LE
+        when :exclude
+          flags |= TableCursorFlags::LT
+        end
+
+        table_cursor = TableCursor.open(range_index.table,
+                                        :min => min,
+                                        :max => max,
+                                        :flags => flags)
+        begin
+          index_cursor = IndexCursor.open(table_cursor, range_index)
+          begin
+            index_cursor.count
+          ensure
+            index_cursor.close
+          end
+        ensure
+          table_cursor.close
+        end
+      end
+
       class ShardRange
         attr_reader :year, :month, :day
         def initialize(year, month, day)

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/max_exclude.expected (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/max_exclude.expected    2015-02-05 13:04:55 +0900 (ce9fceb)
@@ -0,0 +1,49 @@
+register sharding/search
+[[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]
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150203 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]
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150204 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]
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"}
+]
+[[0,0.0,0.0],4]
+logical_count Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "exclude"
+[[0,0.0,0.0],2]

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/max_exclude.test (+43 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/max_exclude.test    2015-02-05 13:04:55 +0900 (abd949a)
@@ -0,0 +1,43 @@
+#@on-error omit
+register sharding/search
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150203 index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150204 index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"}
+]
+
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"}
+]
+
+logical_count Logs timestamp \
+  --max "2015-02-04 00:00:00" \
+  --max_border "exclude"

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/max_include.expected (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/max_include.expected    2015-02-05 13:04:55 +0900 (179621e)
@@ -0,0 +1,49 @@
+register sharding/search
+[[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]
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150203 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]
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150204 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]
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"}
+]
+[[0,0.0,0.0],4]
+logical_count Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "include"
+[[0,0.0,0.0],3]

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/max_include.test (+43 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/max_include.test    2015-02-05 13:04:55 +0900 (ecde965)
@@ -0,0 +1,43 @@
+#@on-error omit
+register sharding/search
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150203 index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150204 index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"}
+]
+
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"}
+]
+
+logical_count Logs timestamp \
+  --max "2015-02-04 00:00:00" \
+  --max_border "include"

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude.expected (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude.expected    2015-02-05 13:04:55 +0900 (0733fbd)
@@ -0,0 +1,49 @@
+register sharding/search
+[[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]
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150203 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]
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150204 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]
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"}
+]
+[[0,0.0,0.0],4]
+logical_count Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "exclude"
+[[0,0.0,0.0],6]

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude.test (+43 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude.test    2015-02-05 13:04:55 +0900 (aadbb25)
@@ -0,0 +1,43 @@
+#@on-error omit
+register sharding/search
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150203 index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150204 index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"}
+]
+
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"}
+]
+
+logical_count Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "exclude"

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_exclude.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_exclude.expected    2015-02-05 13:04:55 +0900 (fb7ae88)
@@ -0,0 +1,53 @@
+register sharding/search
+[[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]
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150203 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]
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150204 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]
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 00:00:01"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"},
+{"timestamp": "2015-02-04 23:59:59"}
+]
+[[0,0.0,0.0],5]
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 00:00:00"},
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"},
+{"timestamp": "2015-02-05 13:53:00"}
+]
+[[0,0.0,0.0],6]
+logical_count Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "exclude"   --max "2015-02-05 00:00:00"   --max_border "exclude"
+[[0,0.0,0.0],4]

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_exclude.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_exclude.test    2015-02-05 13:04:55 +0900 (5c49ad9)
@@ -0,0 +1,49 @@
+#@on-error omit
+register sharding/search
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150203 index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150204 index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 00:00:01"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"},
+{"timestamp": "2015-02-04 23:59:59"}
+]
+
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 00:00:00"},
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"},
+{"timestamp": "2015-02-05 13:53:00"}
+]
+
+logical_count Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "exclude" \
+  --max "2015-02-05 00:00:00" \
+  --max_border "exclude"

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_include.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_include.expected    2015-02-05 13:04:55 +0900 (1f0cdea)
@@ -0,0 +1,53 @@
+register sharding/search
+[[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]
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150203 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]
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150204 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]
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 00:00:01"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"},
+{"timestamp": "2015-02-04 23:59:59"}
+]
+[[0,0.0,0.0],5]
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 00:00:00"},
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"},
+{"timestamp": "2015-02-05 13:53:00"}
+]
+[[0,0.0,0.0],6]
+logical_count Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "exclude"   --max "2015-02-05 00:00:00"   --max_border "include"
+[[0,0.0,0.0],5]

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_include.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_exclude_max_include.test    2015-02-05 13:04:55 +0900 (0cee53c)
@@ -0,0 +1,49 @@
+#@on-error omit
+register sharding/search
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150203 index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150204 index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 00:00:01"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"},
+{"timestamp": "2015-02-04 23:59:59"}
+]
+
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 00:00:00"},
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"},
+{"timestamp": "2015-02-05 13:53:00"}
+]
+
+logical_count Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "exclude" \
+  --max "2015-02-05 00:00:00" \
+  --max_border "include"

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_include.expected (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_include.expected    2015-02-05 13:04:55 +0900 (5e10a04)
@@ -0,0 +1,49 @@
+register sharding/search
+[[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]
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150203 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]
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150204 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]
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"}
+]
+[[0,0.0,0.0],4]
+logical_count Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"
+[[0,0.0,0.0],7]

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_include.test (+43 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_include.test    2015-02-05 13:04:55 +0900 (588f25c)
@@ -0,0 +1,43 @@
+#@on-error omit
+register sharding/search
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150203 index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150204 index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"}
+]
+
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"}
+]
+
+logical_count Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "include"

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_exclude.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_exclude.expected    2015-02-05 13:04:55 +0900 (bad6219)
@@ -0,0 +1,53 @@
+register sharding/search
+[[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]
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150203 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]
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150204 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]
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 00:00:01"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"},
+{"timestamp": "2015-02-04 23:59:59"}
+]
+[[0,0.0,0.0],5]
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 00:00:00"},
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"},
+{"timestamp": "2015-02-05 13:53:00"}
+]
+[[0,0.0,0.0],6]
+logical_count Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"   --max "2015-02-05 00:00:00"   --max_border "exclude"
+[[0,0.0,0.0],5]

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_exclude.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_exclude.test    2015-02-05 13:04:55 +0900 (f9db863)
@@ -0,0 +1,49 @@
+#@on-error omit
+register sharding/search
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150203 index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150204 index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 00:00:01"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"},
+{"timestamp": "2015-02-04 23:59:59"}
+]
+
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 00:00:00"},
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"},
+{"timestamp": "2015-02-05 13:53:00"}
+]
+
+logical_count Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "include" \
+  --max "2015-02-05 00:00:00" \
+  --max_border "exclude"

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_include.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_include.expected    2015-02-05 13:04:55 +0900 (4d02969)
@@ -0,0 +1,53 @@
+register sharding/search
+[[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]
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150203 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]
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150204 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]
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+[[0,0.0,0.0],true]
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+[[0,0.0,0.0],2]
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 00:00:01"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"},
+{"timestamp": "2015-02-04 23:59:59"}
+]
+[[0,0.0,0.0],5]
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 00:00:00"},
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"},
+{"timestamp": "2015-02-05 13:53:00"}
+]
+[[0,0.0,0.0],6]
+logical_count Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"   --max "2015-02-05 00:00:00"   --max_border "include"
+[[0,0.0,0.0],6]

  Added: test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_include.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/no_condition/range/index/min_include_max_include.test    2015-02-05 13:04:55 +0900 (1dad2a6)
@@ -0,0 +1,49 @@
+#@on-error omit
+register sharding/search
+#@on-error default
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150203 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150203 index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150204 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150204 index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create Logs_20150205 TABLE_NO_KEY
+column_create Logs_20150205 timestamp COLUMN_SCALAR Time
+table_create TimestampIndex_20150205 TABLE_PAT_KEY Time
+column_create TimestampIndex_20150205 index COLUMN_INDEX Logs_20150205 timestamp
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00"},
+{"timestamp": "2015-02-03 23:59:59"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00"},
+{"timestamp": "2015-02-04 00:00:01"},
+{"timestamp": "2015-02-04 13:49:00"},
+{"timestamp": "2015-02-04 13:50:00"},
+{"timestamp": "2015-02-04 23:59:59"}
+]
+
+load --table Logs_20150205
+[
+{"timestamp": "2015-02-05 00:00:00"},
+{"timestamp": "2015-02-05 13:49:00"},
+{"timestamp": "2015-02-05 13:50:00"},
+{"timestamp": "2015-02-05 13:51:00"},
+{"timestamp": "2015-02-05 13:52:00"},
+{"timestamp": "2015-02-05 13:53:00"}
+]
+
+logical_count Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "include" \
+  --max "2015-02-05 00:00:00" \
+  --max_border "include"
-------------- next part --------------
HTML����������������������������...
Download 



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