[Groonga-commit] groonga/groonga at bb614c2 [master] logical_select : add post_filter

Back to archive index

Yasuhiro Horimoto null+****@clear*****
Mon Feb 19 17:14:00 JST 2018


Yasuhiro Horimoto	2018-02-19 17:14:00 +0900 (Mon, 19 Feb 2018)

  New Revision: bb614c2bdbc79ad9356bb1a14181bddab228b025
  https://github.com/groonga/groonga/commit/bb614c2bdbc79ad9356bb1a14181bddab228b025

  Merged 36174b1: Merge pull request #824 from komainu8/add_post_filter_in_logical_select

  Message:
    logical_select : add post_filter

  Modified files:
    plugins/sharding/logical_select.rb

  Modified: plugins/sharding/logical_select.rb (+18 -0)
===================================================================
--- plugins/sharding/logical_select.rb    2018-02-19 16:14:30 +0900 (e794f476b)
+++ plugins/sharding/logical_select.rb    2018-02-19 17:14:00 +0900 (668ad8f4b)
@@ -28,6 +28,7 @@ module Groonga
                  "match_columns",
                  "query",
                  "drilldown_filter",
+                 "post_filter",
                ])
 
       def run_body(input)
@@ -99,6 +100,7 @@ module Groonga
           key << "#{drilldown.filter}\0"
           key << drilldown.dynamic_columns.cache_key
         end
+        key << "#{input[:post_filter]}\0"
         dynamic_columns = DynamicColumns.parse(input)
         key << dynamic_columns.cache_key
         key
@@ -278,6 +280,7 @@ module Groonga
         attr_reader :labeled_drilldowns
         attr_reader :temporary_tables
         attr_reader :expressions
+        attr_reader :post_filter
         def initialize(input)
           @input = input
           @enumerator = LogicalEnumerator.new("logical_select", @input)
@@ -300,6 +303,8 @@ module Groonga
           @temporary_tables = []
 
           @expressions = []
+
+          @post_filter = @input[:post_filter]
         end
 
         def close
@@ -682,6 +687,7 @@ module Groonga
           @match_columns =****@conte*****_columns
           @query =****@conte*****
           @filter =****@conte*****
+          @post_filter =****@conte*****_filter
           @sort_keys =****@conte*****_keys
           @result_sets =****@conte*****_sets
           @unsorted_result_sets =****@conte*****_result_sets
@@ -778,6 +784,12 @@ module Groonga
           add_result_set(table.select(expression), expression)
         end
 
+        def apply_post_filter(table)
+          expression = create_expression(table)
+          expression.parse(@post_filter)
+          table.select(expression)
+        end
+
         def add_result_set(result_set, condition)
           query_logger.log(:size, ":",
                            "select(#{result_set.size})[#{@shard.table_name}]")
@@ -794,6 +806,12 @@ module Groonga
             dynamic_column.apply(result_set, condition)
           end
 
+          unless @post_filter.nil?
+            filtered_table = result_set
+            result_set = apply_post_filter(filtered_table)
+            @context.temporary_tables << filtered_table
+          end
+
           if @sort_keys.empty?
             @result_sets << result_set
           else
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180219/58e38791/attachment-0001.htm 



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