[Groonga-commit] groonga/groonga at 010f24b [master] logical_count: add post_filter and filtered stage dynamic columns

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Feb 19 15:49:07 JST 2018


Kouhei Sutou	2018-02-19 15:49:07 +0900 (Mon, 19 Feb 2018)

  New Revision: 010f24b250c68620b8bf9b54070f74a63bcbbf4e
  https://github.com/groonga/groonga/commit/010f24b250c68620b8bf9b54070f74a63bcbbf4e

  Message:
    logical_count: add post_filter and filtered stage dynamic columns

  Added files:
    test/command/suite/sharding/logical_count/post_filter/filtered_column.expected
    test/command/suite/sharding/logical_count/post_filter/filtered_column.test
    test/command/suite/sharding/logical_count/post_filter/min.expected
    test/command/suite/sharding/logical_count/post_filter/min.test
    test/command/suite/sharding/logical_count/post_filter/no_filter.expected
    test/command/suite/sharding/logical_count/post_filter/no_filter.test
    test/command/suite/sharding/logical_count/post_filter/no_filtered_column.expected
    test/command/suite/sharding/logical_count/post_filter/no_filtered_column.test
  Modified files:
    plugins/sharding/logical_count.rb

  Modified: plugins/sharding/logical_count.rb (+36 -5)
===================================================================
--- plugins/sharding/logical_count.rb    2018-02-19 15:33:02 +0900 (5dbb28e9b)
+++ plugins/sharding/logical_count.rb    2018-02-19 15:49:07 +0900 (b39d5f859)
@@ -10,6 +10,7 @@ module Groonga
                  "max",
                  "max_border",
                  "filter",
+                 "post_filter",
                ])
 
       def run_body(input)
@@ -43,6 +44,7 @@ module Groonga
         key << "#{input[:max]}\0"
         key << "#{input[:max_border]}\0"
         key << "#{input[:filter]}\0"
+        key << "#{input[:post_filter]}\0"
         dynamic_columns = DynamicColumns.parse(input)
         key << dynamic_columns.cache_key
         key
@@ -52,6 +54,7 @@ module Groonga
         def initialize(input, target_range)
           @logger = Context.instance.logger
           @filter = input[:filter]
+          @post_filter = input[:post_filter]
           @dynamic_columns = DynamicColumns.parse(input)
           @target_range = target_range
         end
@@ -72,7 +75,7 @@ module Groonga
             if cover_type == :all
               log_use_range_index(false, table_name, "covered",
                                   __LINE__, __method__)
-              if @filter
+              if @filter or @post_filter
                 return filtered_count_n_records(table, shard_key, cover_type)
               else
                 return table.size
@@ -80,7 +83,7 @@ module Groonga
             end
 
             range_index = nil
-            if @filter
+            if @filter or @post_filter
               log_use_range_index(false, table_name, "need filter",
                                   __LINE__, __method__)
             else
@@ -121,7 +124,7 @@ module Groonga
 
         def prepare_table(shard)
           table = shard.table
-          return yield(table) if****@filte*****?
+          return yield(table) if****@filte*****? and @post_filter.nil?
 
           @dynamic_columns.each_initial do |dynamic_column|
             if table == shard.table
@@ -156,14 +159,42 @@ module Groonga
             when :partial_min_and_max
               expression_builder.build_partial_min_and_max(expression)
             end
-            filtered_table = table.select(expression)
-            filtered_table.size
+            if cover_type == :all and****@filte*****?
+              # TODO: We can drop needless select when filtered stage dynamic
+              # doesn't exist.
+              filtered_table = table.select_all
+            else
+              filtered_table = table.select(expression)
+            end
+            if @post_filter
+              post_filtered_count_n_records(filtered_table)
+            else
+              filtered_table.size
+            end
           ensure
             filtered_table.close if filtered_table
             expression.close if expression
           end
         end
 
+        def post_filtered_count_n_records(filtered_table)
+          @dynamic_columns.each_filtered do |dynamic_column|
+            dynamic_column.apply(filtered_table)
+          end
+
+          expression = nil
+          post_filtered_table = nil
+          begin
+            expression = Expression.create(filtered_table)
+            expression.parse(@post_filter)
+            post_filtered_table = filtered_table.select(expression)
+            post_filtered_table.size
+          ensure
+            post_filtered_table.close if post_filtered_table
+            expression.close if expression
+          end
+        end
+
         def count_n_records_in_range(range_index, cover_type)
           case cover_type
           when :partial_min

  Added: test/command/suite/sharding/logical_count/post_filter/filtered_column.expected (+58 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/post_filter/filtered_column.expected    2018-02-19 15:49:07 +0900 (372a3a3a4)
@@ -0,0 +1,58 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20170315 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170316 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170317 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 01:00:00", "price":  900},
+{"timestamp": "2017/03/15 02:00:00", "price":  300}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 10:00:00", "price":  530},
+{"timestamp": "2017/03/16 11:00:00", "price":  520},
+{"timestamp": "2017/03/16 12:00:00", "price":  110}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 20:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  300}
+]
+[[0,0.0,0.0],3]
+table_create Times TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp
+[[0,0.0,0.0],true]
+column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp
+[[0,0.0,0.0],true]
+column_create Times logs_20170317 COLUMN_INDEX Logs_20170317 timestamp
+[[0,0.0,0.0],true]
+log_level --level debug
+[[0,0.0,0.0],true]
+logical_count Logs   --shard_key timestamp   --columns[filtered_id].stage filtered   --columns[filtered_id].type UInt32   --columns[filtered_id].flags COLUMN_SCALAR   --columns[filtered_id].value '_id'   --filter 'price >= 200'   --post_filter 'filtered_id > 1'
+[[0,0.0,0.0],5]
+#|d| [logical_count][select] <Logs_20170315>: covered
+#|d| [logical_count][select] <Logs_20170316>: covered
+#|d| [logical_count][select] <Logs_20170317>: covered
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/sharding/logical_count/post_filter/filtered_column.test (+54 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/post_filter/filtered_column.test    2018-02-19 15:49:07 +0900 (8690b1b35)
@@ -0,0 +1,54 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20170315 TABLE_NO_KEY
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170316 TABLE_NO_KEY
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170317 TABLE_NO_KEY
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 01:00:00", "price":  900},
+{"timestamp": "2017/03/15 02:00:00", "price":  300}
+]
+
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 10:00:00", "price":  530},
+{"timestamp": "2017/03/16 11:00:00", "price":  520},
+{"timestamp": "2017/03/16 12:00:00", "price":  110}
+]
+
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 20:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  300}
+]
+
+table_create Times TABLE_PAT_KEY Time
+column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp
+column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp
+column_create Times logs_20170317 COLUMN_INDEX Logs_20170317 timestamp
+
+#@add-important-log-levels debug
+log_level --level debug
+logical_count Logs \
+  --shard_key timestamp \
+  --columns[filtered_id].stage filtered \
+  --columns[filtered_id].type UInt32 \
+  --columns[filtered_id].flags COLUMN_SCALAR \
+  --columns[filtered_id].value '_id' \
+  --filter 'price >= 200' \
+  --post_filter 'filtered_id > 1'
+log_level --level notice
+#@remove-important-log-levels debug

  Added: test/command/suite/sharding/logical_count/post_filter/min.expected (+58 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/post_filter/min.expected    2018-02-19 15:49:07 +0900 (9b3d021ed)
@@ -0,0 +1,58 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20170315 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170316 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170317 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 01:00:00", "price":  900},
+{"timestamp": "2017/03/15 02:00:00", "price":  300}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 10:00:00", "price":  530},
+{"timestamp": "2017/03/16 11:00:00", "price":  520},
+{"timestamp": "2017/03/16 12:00:00", "price":  110}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 20:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  300}
+]
+[[0,0.0,0.0],3]
+table_create Times TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp
+[[0,0.0,0.0],true]
+column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp
+[[0,0.0,0.0],true]
+column_create Times logs_20170317 COLUMN_INDEX Logs_20170317 timestamp
+[[0,0.0,0.0],true]
+log_level --level debug
+[[0,0.0,0.0],true]
+logical_count Logs   --shard_key timestamp   --min "2017/03/15 01:00:00"   --min_border "include"   --columns[filtered_id].stage filtered   --columns[filtered_id].type UInt32   --columns[filtered_id].flags COLUMN_SCALAR   --columns[filtered_id].value '_id'   --filter 'price >= 200'   --post_filter 'filtered_id < 3'
+[[0,0.0,0.0],5]
+#|d| [logical_count][select] <Logs_20170315>: need filter
+#|d| [logical_count][select] <Logs_20170316>: covered
+#|d| [logical_count][select] <Logs_20170317>: covered
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/sharding/logical_count/post_filter/min.test (+56 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/post_filter/min.test    2018-02-19 15:49:07 +0900 (d98462ecd)
@@ -0,0 +1,56 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20170315 TABLE_NO_KEY
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170316 TABLE_NO_KEY
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170317 TABLE_NO_KEY
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 01:00:00", "price":  900},
+{"timestamp": "2017/03/15 02:00:00", "price":  300}
+]
+
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 10:00:00", "price":  530},
+{"timestamp": "2017/03/16 11:00:00", "price":  520},
+{"timestamp": "2017/03/16 12:00:00", "price":  110}
+]
+
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 20:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  300}
+]
+
+table_create Times TABLE_PAT_KEY Time
+column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp
+column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp
+column_create Times logs_20170317 COLUMN_INDEX Logs_20170317 timestamp
+
+#@add-important-log-levels debug
+log_level --level debug
+logical_count Logs \
+  --shard_key timestamp \
+  --min "2017/03/15 01:00:00" \
+  --min_border "include" \
+  --columns[filtered_id].stage filtered \
+  --columns[filtered_id].type UInt32 \
+  --columns[filtered_id].flags COLUMN_SCALAR \
+  --columns[filtered_id].value '_id' \
+  --filter 'price >= 200' \
+  --post_filter 'filtered_id < 3'
+log_level --level notice
+#@remove-important-log-levels debug

  Added: test/command/suite/sharding/logical_count/post_filter/no_filter.expected (+58 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/post_filter/no_filter.expected    2018-02-19 15:49:07 +0900 (11ca3490e)
@@ -0,0 +1,58 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20170315 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170316 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170317 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 01:00:00", "price":  900},
+{"timestamp": "2017/03/15 02:00:00", "price":  300}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 10:00:00", "price":  530},
+{"timestamp": "2017/03/16 11:00:00", "price":  520},
+{"timestamp": "2017/03/16 12:00:00", "price":  110}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 20:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  300}
+]
+[[0,0.0,0.0],3]
+table_create Times TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp
+[[0,0.0,0.0],true]
+column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp
+[[0,0.0,0.0],true]
+column_create Times logs_20170317 COLUMN_INDEX Logs_20170317 timestamp
+[[0,0.0,0.0],true]
+log_level --level debug
+[[0,0.0,0.0],true]
+logical_count Logs   --shard_key timestamp   --post_filter '_id < 3'
+[[0,0.0,0.0],6]
+#|d| [logical_count][select] <Logs_20170315>: covered
+#|d| [logical_count][select] <Logs_20170316>: covered
+#|d| [logical_count][select] <Logs_20170317>: covered
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/sharding/logical_count/post_filter/no_filter.test (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/post_filter/no_filter.test    2018-02-19 15:49:07 +0900 (7b784153c)
@@ -0,0 +1,49 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20170315 TABLE_NO_KEY
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170316 TABLE_NO_KEY
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170317 TABLE_NO_KEY
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 01:00:00", "price":  900},
+{"timestamp": "2017/03/15 02:00:00", "price":  300}
+]
+
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 10:00:00", "price":  530},
+{"timestamp": "2017/03/16 11:00:00", "price":  520},
+{"timestamp": "2017/03/16 12:00:00", "price":  110}
+]
+
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 20:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  300}
+]
+
+table_create Times TABLE_PAT_KEY Time
+column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp
+column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp
+column_create Times logs_20170317 COLUMN_INDEX Logs_20170317 timestamp
+
+#@add-important-log-levels debug
+log_level --level debug
+logical_count Logs \
+  --shard_key timestamp \
+  --post_filter '_id < 3'
+log_level --level notice
+#@remove-important-log-levels debug

  Added: test/command/suite/sharding/logical_count/post_filter/no_filtered_column.expected (+58 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/post_filter/no_filtered_column.expected    2018-02-19 15:49:07 +0900 (62caba77c)
@@ -0,0 +1,58 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+table_create Logs_20170315 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170316 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170317 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 01:00:00", "price":  900},
+{"timestamp": "2017/03/15 02:00:00", "price":  300}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 10:00:00", "price":  530},
+{"timestamp": "2017/03/16 11:00:00", "price":  520},
+{"timestamp": "2017/03/16 12:00:00", "price":  110}
+]
+[[0,0.0,0.0],3]
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 20:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  300}
+]
+[[0,0.0,0.0],3]
+table_create Times TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp
+[[0,0.0,0.0],true]
+column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp
+[[0,0.0,0.0],true]
+column_create Times logs_20170317 COLUMN_INDEX Logs_20170317 timestamp
+[[0,0.0,0.0],true]
+log_level --level debug
+[[0,0.0,0.0],true]
+logical_count Logs   --shard_key timestamp   --filter 'price >= 200'   --post_filter '_id > 1'
+[[0,0.0,0.0],5]
+#|d| [logical_count][select] <Logs_20170315>: covered
+#|d| [logical_count][select] <Logs_20170316>: covered
+#|d| [logical_count][select] <Logs_20170317>: covered
+log_level --level notice
+[[0,0.0,0.0],true]

  Added: test/command/suite/sharding/logical_count/post_filter/no_filtered_column.test (+50 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_count/post_filter/no_filtered_column.test    2018-02-19 15:49:07 +0900 (630150e33)
@@ -0,0 +1,50 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Logs_20170315 TABLE_NO_KEY
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170316 TABLE_NO_KEY
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170317 TABLE_NO_KEY
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 01:00:00", "price":  900},
+{"timestamp": "2017/03/15 02:00:00", "price":  300}
+]
+
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 10:00:00", "price":  530},
+{"timestamp": "2017/03/16 11:00:00", "price":  520},
+{"timestamp": "2017/03/16 12:00:00", "price":  110}
+]
+
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 20:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  300}
+]
+
+table_create Times TABLE_PAT_KEY Time
+column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp
+column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp
+column_create Times logs_20170317 COLUMN_INDEX Logs_20170317 timestamp
+
+#@add-important-log-levels debug
+log_level --level debug
+logical_count Logs \
+  --shard_key timestamp \
+  --filter 'price >= 200' \
+  --post_filter '_id > 1'
+log_level --level notice
+#@remove-important-log-levels debug
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180219/d8776c47/attachment-0001.htm 



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