[Groonga-commit] groonga/groonga at 3cbafd9 [master] mrb optimizer: support match_columns

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Aug 31 11:53:09 JST 2018


Kouhei Sutou	2018-08-31 11:53:09 +0900 (Fri, 31 Aug 2018)

  Revision: 3cbafd9d169f0e52d7a89b9c44b5c28619d6f3e1
  https://github.com/groonga/groonga/commit/3cbafd9d169f0e52d7a89b9c44b5c28619d6f3e1

  Message:
    mrb optimizer: support match_columns

  Modified files:
    lib/mrb/scripts/expression_tree/binary_operation.rb

  Modified: lib/mrb/scripts/expression_tree/binary_operation.rb (+30 -6)
===================================================================
--- lib/mrb/scripts/expression_tree/binary_operation.rb    2018-08-31 11:47:24 +0900 (cdeab5f67)
+++ lib/mrb/scripts/expression_tree/binary_operation.rb    2018-08-31 11:53:09 +0900 (80ad0260a)
@@ -79,13 +79,37 @@ module Groonga
         return table.size unles****@right*****_a?(Constant)
 
         column =****@left*****
-        value =****@right*****
-        index_info = column.find_index(@operator)
-        return table.size if index_info.nil?
+        indexes = []
+        case column
+        when Expression
+          column.codes.each do |code|
+            case code.op
+            when Operator::GET_VALUE
+              value = code.value
+              case value
+              when IndexColumn
+                indexes << index
+              when Column
+                index_info = value.find_index(@operator)
+                return table.size if index_info.nil?
+                indexes << index_info.index
+              end
+            end
+          end
+        else
+          index_info = column.find_index(@operator)
+          return table.size if index_info.nil?
+          indexes << index_info.index
+        end
 
-        index_column = index_info.index
-        index_column.estimate_size(:query => value,
-                                   :mode => @operator)
+        return table.size if indexes.empty?
+
+        value =****@right*****
+        sizes = indexes.collect do |index|
+          index.estimate_size(:query => value,
+                              :mode => @operator)
+        end
+        sizes.max
       end
     end
   end
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180831/34c60d2f/attachment-0001.htm 



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