Kouhei Sutou
null+****@clear*****
Thu May 25 10:43:26 JST 2017
Kouhei Sutou 2017-05-25 10:43:26 +0900 (Thu, 25 May 2017) New Revision: 91adebbb86ad5555b4afb673bd87137e88a0e6f9 https://github.com/groonga/groonga/commit/91adebbb86ad5555b4afb673bd87137e88a0e6f9 Message: sharding: fix a bug that 23:59:59.999999 isn't included in target range Added files: test/command/suite/sharding/logical_select/range/min_last_day.expected test/command/suite/sharding/logical_select/range/min_last_day.test Modified files: plugins/sharding/logical_enumerator.rb Modified: plugins/sharding/logical_enumerator.rb (+5 -1) =================================================================== --- plugins/sharding/logical_enumerator.rb 2017-05-25 10:37:50 +0900 (d770c90) +++ plugins/sharding/logical_enumerator.rb 2017-05-25 10:43:26 +0900 (32cc4b5) @@ -162,7 +162,11 @@ module Groonga end def least_over_time - Time.local(@year, @month, @day, 23, 59, 59, 999999) + over_time = Time.local(@year, @month, @day) + (60 * 60 * 24) + while over_time.day == @day # For leap second + over_time += 1 + end + over_time end def min_time Added: test/command/suite/sharding/logical_select/range/min_last_day.expected (+81 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/range/min_last_day.expected 2017-05-25 10:43:26 +0900 (ec7de21) @@ -0,0 +1,81 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20150131 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150131 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150131 memo COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Times_20150131 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150131 timestamp_index COLUMN_INDEX Logs_20150131 timestamp +[[0,0.0,0.0],true] +table_create Logs_20150201 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150201 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150201 memo COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Times_20150201 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150201 timestamp_index COLUMN_INDEX Logs_20150201 timestamp +[[0,0.0,0.0],true] +load --table Logs_20150131 +[ +{ + "timestamp": "2015-01-31 00:00:00", + "memo": "2015-01-31 00:00:00" +}, +{ + "timestamp": "2015-01-31 23:59:59.999999", + "memo": "2015-01-31 23:59:59.999999" +} +] +[[0,0.0,0.0],2] +load --table Logs_20150201 +[ +{ + "timestamp": "2015-02-01 00:00:00", + "memo": "2015-02-01 00:00:00" +} +] +[[0,0.0,0.0],1] +logical_select Logs timestamp --min "2015-01-31 23:59:59.999999" --min_border "include" +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 2 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "memo", + "ShortText" + ], + [ + "timestamp", + "Time" + ] + ], + [ + 2, + "2015-01-31 23:59:59.999999", + 1422716399.999999 + ], + [ + 1, + "2015-02-01 00:00:00", + 1422716400.0 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/range/min_last_day.test (+39 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/range/min_last_day.test 2017-05-25 10:43:26 +0900 (c259c99) @@ -0,0 +1,39 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +table_create Logs_20150131 TABLE_NO_KEY +column_create Logs_20150131 timestamp COLUMN_SCALAR Time +column_create Logs_20150131 memo COLUMN_SCALAR ShortText +table_create Times_20150131 TABLE_PAT_KEY Time +column_create Times_20150131 timestamp_index COLUMN_INDEX Logs_20150131 timestamp + +table_create Logs_20150201 TABLE_NO_KEY +column_create Logs_20150201 timestamp COLUMN_SCALAR Time +column_create Logs_20150201 memo COLUMN_SCALAR ShortText +table_create Times_20150201 TABLE_PAT_KEY Time +column_create Times_20150201 timestamp_index COLUMN_INDEX Logs_20150201 timestamp + +load --table Logs_20150131 +[ +{ + "timestamp": "2015-01-31 00:00:00", + "memo": "2015-01-31 00:00:00" +}, +{ + "timestamp": "2015-01-31 23:59:59.999999", + "memo": "2015-01-31 23:59:59.999999" +} +] + +load --table Logs_20150201 +[ +{ + "timestamp": "2015-02-01 00:00:00", + "memo": "2015-02-01 00:00:00" +} +] + +logical_select Logs timestamp \ + --min "2015-01-31 23:59:59.999999" \ + --min_border "include" -------------- next part -------------- HTML����������������������������...Download