Kouhei Sutou
null+****@clear*****
Tue Oct 31 18:00:55 JST 2017
Kouhei Sutou 2017-10-31 18:00:55 +0900 (Tue, 31 Oct 2017) New Revision: 72ad95d467854614128eb440de1609b0b2a8445a https://github.com/groonga/groonga/commit/72ad95d467854614128eb440de1609b0b2a8445a Message: sharding: extract convenient code as Table#select_all Modified files: lib/mrb/scripts/table.rb plugins/sharding/logical_select.rb Modified: lib/mrb/scripts/table.rb (+10 -0) =================================================================== --- lib/mrb/scripts/table.rb 2017-10-31 16:20:23 +0900 (ba4b7a1d4) +++ lib/mrb/scripts/table.rb 2017-10-31 18:00:55 +0900 (fbfa88c4c) @@ -61,6 +61,16 @@ module Groonga end end + def select_all + expression = Expression.create(self) + begin + expression.append_constant(true, Operator::PUSH, 1) + select(expression) + ensure + expression.close + end + end + private def ensure_sort_keys_accept_nil(keys, &block) return yield(nil) if keys.nil? Modified: plugins/sharding/logical_select.rb (+2 -13) =================================================================== --- plugins/sharding/logical_select.rb 2017-10-31 16:20:23 +0900 (b96a8eedd) +++ plugins/sharding/logical_select.rb 2017-10-31 18:00:55 +0900 (1ffa380b8) @@ -692,7 +692,7 @@ module Groonga @context.dynamic_columns.each_initial do |dynamic_column| if @target_table ==****@shard***** - @target_table = create_all_match_table(@target_table) + @target_table = @target_table.select_all @context.temporary_tables << @target_table end dynamic_column.apply(@target_table) @@ -765,8 +765,7 @@ module Groonga @context.dynamic_columns.each_filtered do |dynamic_column| if result_set ==****@shard***** - @context.temporary_tables << result_set - result_set = create_all_match_table(result_set) + result_set = result_set.select_all end dynamic_column.apply(result_set, condition) end @@ -779,16 +778,6 @@ module Groonga @result_sets << sorted_result_set end end - - def create_all_match_table(table) - expression = Expression.create(table) - begin - expression.append_constant(true, Operator::PUSH, 1) - table.select(expression) - ensure - expression.close - end - end end end end -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171031/5284bcf3/attachment-0001.htm