[Groonga-commit] groonga/groonga at 42606e4 [master] Fix a bug that occur "argument out of range" when setting last day of month to the min.

Back to archive index

HorimotoYasuhiro null+****@clear*****
Wed May 24 16:57:01 JST 2017


HorimotoYasuhiro	2017-05-24 16:57:01 +0900 (Wed, 24 May 2017)

  New Revision: 42606e4d57051ab7b23905af6e90b78306c6421a
  https://github.com/groonga/groonga/commit/42606e4d57051ab7b23905af6e90b78306c6421a

  Merged 30110fc: Merge pull request #698 from komainu8/feature/fix_least_over_time

  Message:
    Fix a bug that occur "argument out of range" when setting last day of month to the min.

  Modified files:
    plugins/sharding/logical_enumerator.rb
    test/command/suite/sharding/logical_select/no_condition/max_exclude.expected
    test/command/suite/sharding/logical_select/no_condition/max_exclude.test
    test/command/suite/sharding/logical_select/no_condition/max_include.expected
    test/command/suite/sharding/logical_select/no_condition/max_include.test
    test/command/suite/sharding/logical_select/no_condition/min_exclude.expected
    test/command/suite/sharding/logical_select/no_condition/min_exclude.test
    test/command/suite/sharding/logical_select/no_condition/min_include.expected
    test/command/suite/sharding/logical_select/no_condition/min_include.test

  Modified: plugins/sharding/logical_enumerator.rb (+4 -3)
===================================================================
--- plugins/sharding/logical_enumerator.rb    2017-05-23 13:34:13 +0900 (260afdb)
+++ plugins/sharding/logical_enumerator.rb    2017-05-24 16:57:01 +0900 (a1c9699)
@@ -162,7 +162,7 @@ module Groonga
         end
 
         def least_over_time
-          Time.local(@year, @month, @day + 1)
+          Time.local(@year, @month, @day, 23, 59, 59, 999999)
         end
 
         def min_time
@@ -186,9 +186,10 @@ module Groonga
 
         def least_over_time
           if @max_day.nil?
-            Time.local(@year, @month + 1, 1)
+             @next_month = (1..11).include?(@month) ? @month+1 : 1
+             Time.local(@year, @next_month, 1)
           else
-            Time.local(@year, @month, @max_day + 1)
+            Time.local(@year, @month, @max_day, 23, 59, 59, 999999)
           end
         end
 

  Modified: test/command/suite/sharding/logical_select/no_condition/max_exclude.expected (+33 -1)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/max_exclude.expected    2017-05-23 13:34:13 +0900 (f1a684d)
+++ test/command/suite/sharding/logical_select/no_condition/max_exclude.expected    2017-05-24 16:57:01 +0900 (be9d38e)
@@ -30,6 +30,16 @@ table_create Times_20150205 TABLE_PAT_KEY Time
 [[0,0.0,0.0],true]
 column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 [[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]
 load --table Logs_20150203
 [
 {
@@ -78,6 +88,18 @@ load --table Logs_20150205
 }
 ]
 [[0,0.0,0.0],4]
+load --table Logs_20150131
+[
+{
+  "timestamp": "2015-01-31 12:49:00",
+  "memo":      "2015-01-31 12:49:00"
+},
+{
+  "timestamp": "2015-01-31 23:59:59",
+  "memo":      "2015-01-31 23:59:59"
+}
+]
+[[0,0.0,0.0],2]
 logical_select Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "exclude"
 [
   [
@@ -88,7 +110,7 @@ logical_select Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "excl
   [
     [
       [
-        2
+        4
       ],
       [
         [
@@ -106,6 +128,16 @@ logical_select Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "excl
       ],
       [
         1,
+        "2015-01-31 12:49:00",
+        1422676140.0
+      ],
+      [
+        2,
+        "2015-01-31 23:59:59",
+        1422716399.0
+      ],
+      [
+        1,
         "2015-02-03 12:49:00",
         1422935340.0
       ],

  Modified: test/command/suite/sharding/logical_select/no_condition/max_exclude.test (+18 -0)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/max_exclude.test    2017-05-23 13:34:13 +0900 (f16a125)
+++ test/command/suite/sharding/logical_select/no_condition/max_exclude.test    2017-05-24 16:57:01 +0900 (eae3621)
@@ -20,6 +20,12 @@ column_create Logs_20150205 memo COLUMN_SCALAR ShortText
 table_create Times_20150205 TABLE_PAT_KEY Time
 column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 
+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
+
 load --table Logs_20150203
 [
 {
@@ -68,6 +74,18 @@ load --table Logs_20150205
 }
 ]
 
+load --table Logs_20150131
+[
+{
+  "timestamp": "2015-01-31 12:49:00",
+  "memo":      "2015-01-31 12:49:00"
+},
+{
+  "timestamp": "2015-01-31 23:59:59",
+  "memo":      "2015-01-31 23:59:59"
+}
+]
+
 logical_select Logs timestamp \
   --max "2015-02-04 00:00:00" \
   --max_border "exclude"

  Modified: test/command/suite/sharding/logical_select/no_condition/max_include.expected (+33 -1)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/max_include.expected    2017-05-23 13:34:13 +0900 (4b98fd0)
+++ test/command/suite/sharding/logical_select/no_condition/max_include.expected    2017-05-24 16:57:01 +0900 (9319c6d)
@@ -30,6 +30,16 @@ table_create Times_20150205 TABLE_PAT_KEY Time
 [[0,0.0,0.0],true]
 column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 [[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]
 load --table Logs_20150203
 [
 {
@@ -78,6 +88,18 @@ load --table Logs_20150205
 }
 ]
 [[0,0.0,0.0],4]
+load --table Logs_20150131
+[
+{
+  "timestamp": "2015-01-31 12:49:00",
+  "memo":      "2015-01-31 12:49:00"
+},
+{
+  "timestamp": "2015-01-31 23:59:59",
+  "memo":      "2015-01-31 23:59:59"
+}
+]
+[[0,0.0,0.0],2]
 logical_select Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "include"
 [
   [
@@ -88,7 +110,7 @@ logical_select Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "incl
   [
     [
       [
-        3
+        5
       ],
       [
         [
@@ -106,6 +128,16 @@ logical_select Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "incl
       ],
       [
         1,
+        "2015-01-31 12:49:00",
+        1422676140.0
+      ],
+      [
+        2,
+        "2015-01-31 23:59:59",
+        1422716399.0
+      ],
+      [
+        1,
         "2015-02-03 12:49:00",
         1422935340.0
       ],

  Modified: test/command/suite/sharding/logical_select/no_condition/max_include.test (+18 -0)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/max_include.test    2017-05-23 13:34:13 +0900 (068715d)
+++ test/command/suite/sharding/logical_select/no_condition/max_include.test    2017-05-24 16:57:01 +0900 (7ebcc7b)
@@ -20,6 +20,12 @@ column_create Logs_20150205 memo COLUMN_SCALAR ShortText
 table_create Times_20150205 TABLE_PAT_KEY Time
 column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 
+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
+
 load --table Logs_20150203
 [
 {
@@ -68,6 +74,18 @@ load --table Logs_20150205
 }
 ]
 
+load --table Logs_20150131
+[
+{
+  "timestamp": "2015-01-31 12:49:00",
+  "memo":      "2015-01-31 12:49:00"
+},
+{
+  "timestamp": "2015-01-31 23:59:59",
+  "memo":      "2015-01-31 23:59:59"
+}
+]
+
 logical_select Logs timestamp \
   --max "2015-02-04 00:00:00" \
   --max_border "include"

  Modified: test/command/suite/sharding/logical_select/no_condition/min_exclude.expected (+33 -1)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_exclude.expected    2017-05-23 13:34:13 +0900 (48d3fa3)
+++ test/command/suite/sharding/logical_select/no_condition/min_exclude.expected    2017-05-24 16:57:01 +0900 (c95537a)
@@ -30,6 +30,16 @@ table_create Times_20150205 TABLE_PAT_KEY Time
 [[0,0.0,0.0],true]
 column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 [[0,0.0,0.0],true]
+table_create Logs_20150331 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150331 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150331 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Times_20150331 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times_20150331 timestamp_index COLUMN_INDEX Logs_20150331 timestamp
+[[0,0.0,0.0],true]
 load --table Logs_20150203
 [
 {
@@ -78,6 +88,18 @@ load --table Logs_20150205
 }
 ]
 [[0,0.0,0.0],4]
+load --table Logs_20150331
+[
+{
+  "timestamp": "2015-03-31 12:49:00",
+  "memo":      "2015-03-31 12:49:00"
+},
+{
+  "timestamp": "2015-03-31 23:59:59",
+  "memo":      "2015-03-31 23:59:59"
+}
+]
+[[0,0.0,0.0],2]
 logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "exclude"
 [
   [
@@ -88,7 +110,7 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "excl
   [
     [
       [
-        6
+        8
       ],
       [
         [
@@ -133,6 +155,16 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "excl
         4,
         "2015-02-05 13:52:00",
         1423111920.0
+      ],
+      [
+        1,
+        "2015-03-31 12:49:00",
+        1427773740.0
+      ],
+      [
+        2,
+        "2015-03-31 23:59:59",
+        1427813999.0
       ]
     ]
   ]

  Modified: test/command/suite/sharding/logical_select/no_condition/min_exclude.test (+18 -0)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_exclude.test    2017-05-23 13:34:13 +0900 (4eea4a2)
+++ test/command/suite/sharding/logical_select/no_condition/min_exclude.test    2017-05-24 16:57:01 +0900 (cb8bb296)
@@ -20,6 +20,12 @@ column_create Logs_20150205 memo COLUMN_SCALAR ShortText
 table_create Times_20150205 TABLE_PAT_KEY Time
 column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 
+table_create Logs_20150331 TABLE_NO_KEY
+column_create Logs_20150331 timestamp COLUMN_SCALAR Time
+column_create Logs_20150331 memo COLUMN_SCALAR ShortText
+table_create Times_20150331 TABLE_PAT_KEY Time
+column_create Times_20150331 timestamp_index COLUMN_INDEX Logs_20150331 timestamp
+
 load --table Logs_20150203
 [
 {
@@ -68,6 +74,18 @@ load --table Logs_20150205
 }
 ]
 
+load --table Logs_20150331
+[
+{
+  "timestamp": "2015-03-31 12:49:00",
+  "memo":      "2015-03-31 12:49:00"
+},
+{
+  "timestamp": "2015-03-31 23:59:59",
+  "memo":      "2015-03-31 23:59:59"
+}
+]
+
 logical_select Logs timestamp \
   --min "2015-02-04 00:00:00" \
   --min_border "exclude"

  Modified: test/command/suite/sharding/logical_select/no_condition/min_include.expected (+33 -1)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_include.expected    2017-05-23 13:34:13 +0900 (746f1d2)
+++ test/command/suite/sharding/logical_select/no_condition/min_include.expected    2017-05-24 16:57:01 +0900 (4a9bca6)
@@ -30,6 +30,16 @@ table_create Times_20150205 TABLE_PAT_KEY Time
 [[0,0.0,0.0],true]
 column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 [[0,0.0,0.0],true]
+table_create Logs_20150331 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20150331 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20150331 memo COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Times_20150331 TABLE_PAT_KEY Time
+[[0,0.0,0.0],true]
+column_create Times_20150331 timestamp_index COLUMN_INDEX Logs_20150331 timestamp
+[[0,0.0,0.0],true]
 load --table Logs_20150203
 [
 {
@@ -78,6 +88,18 @@ load --table Logs_20150205
 }
 ]
 [[0,0.0,0.0],4]
+load --table Logs_20150331
+[
+{
+  "timestamp": "2015-03-31 12:49:00",
+  "memo":      "2015-03-31 12:49:00"
+},
+{
+  "timestamp": "2015-03-31 23:59:59",
+  "memo":      "2015-03-31 23:59:59"
+}
+]
+[[0,0.0,0.0],2]
 logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"
 [
   [
@@ -88,7 +110,7 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "incl
   [
     [
       [
-        7
+        9
       ],
       [
         [
@@ -138,6 +160,16 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "incl
         4,
         "2015-02-05 13:52:00",
         1423111920.0
+      ],
+      [
+        1,
+        "2015-03-31 12:49:00",
+        1427773740.0
+      ],
+      [
+        2,
+        "2015-03-31 23:59:59",
+        1427813999.0
       ]
     ]
   ]

  Modified: test/command/suite/sharding/logical_select/no_condition/min_include.test (+17 -0)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_include.test    2017-05-23 13:34:13 +0900 (4226a9c)
+++ test/command/suite/sharding/logical_select/no_condition/min_include.test    2017-05-24 16:57:01 +0900 (b86e8f6)
@@ -20,6 +20,12 @@ column_create Logs_20150205 memo COLUMN_SCALAR ShortText
 table_create Times_20150205 TABLE_PAT_KEY Time
 column_create Times_20150205 timestamp_index COLUMN_INDEX Logs_20150205 timestamp
 
+table_create Logs_20150331 TABLE_NO_KEY
+column_create Logs_20150331 timestamp COLUMN_SCALAR Time
+column_create Logs_20150331 memo COLUMN_SCALAR ShortText
+table_create Times_20150331 TABLE_PAT_KEY Time
+column_create Times_20150331 timestamp_index COLUMN_INDEX Logs_20150331 timestamp
+
 load --table Logs_20150203
 [
 {
@@ -67,6 +73,17 @@ load --table Logs_20150205
   "memo":      "2015-02-05 13:52:00"
 }
 ]
+load --table Logs_20150331
+[
+{
+  "timestamp": "2015-03-31 12:49:00",
+  "memo":      "2015-03-31 12:49:00"
+},
+{
+  "timestamp": "2015-03-31 23:59:59",
+  "memo":      "2015-03-31 23:59:59"
+}
+]
 
 logical_select Logs timestamp \
   --min "2015-02-04 00:00:00" \
-------------- next part --------------
HTML����������������������������...
下載 



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