[Groonga-commit] groonga/groonga at bda444e [master] between:support outside of key range

Back to archive index

naoa null+****@clear*****
Mon Aug 4 23:15:33 JST 2014


naoa	2014-08-04 23:15:33 +0900 (Mon, 04 Aug 2014)

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

  Merged 54a2fd4: Merge pull request #183 from naoa/between-over-case

  Message:
    between:support outside of key range

  Added files:
    test/command/suite/select/function/between/with_index/range_outside/max_over.expected
    test/command/suite/select/function/between/with_index/range_outside/max_over.test
    test/command/suite/select/function/between/with_index/range_outside/min_less.expected
    test/command/suite/select/function/between/with_index/range_outside/min_less.test
    test/command/suite/select/function/between/with_index/range_outside/min_less_and_max_over.expected
    test/command/suite/select/function/between/with_index/range_outside/min_less_and_max_over.test
    test/command/suite/select/function/between/without_index/range_outside/max_over.expected
    test/command/suite/select/function/between/without_index/range_outside/max_over.test
    test/command/suite/select/function/between/without_index/range_outside/min_less.expected
    test/command/suite/select/function/between/without_index/range_outside/min_less.test
    test/command/suite/select/function/between/without_index/range_outside/min_less_and_max_over.expected
    test/command/suite/select/function/between/without_index/range_outside/min_less_and_max_over.test
  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+1 -1)
===================================================================
--- lib/proc.c    2014-08-04 14:36:22 +0900 (e525416)
+++ lib/proc.c    2014-08-04 23:15:33 +0900 (84480ab)
@@ -4645,7 +4645,7 @@ selector_between(grn_ctx *ctx, grn_obj *table, grn_obj *index,
   grn_rc rc = GRN_SUCCESS;
   int offset = 0;
   int limit = -1;
-  int flags = GRN_CURSOR_ASCENDING | GRN_CURSOR_BY_ID;
+  int flags = GRN_CURSOR_ASCENDING | GRN_CURSOR_BY_KEY;
   between_data data;
   grn_obj casted_min, casted_max;
   grn_obj *used_min = NULL;

  Added: test/command/suite/select/function/between/with_index/range_outside/max_over.expected (+61 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/with_index/range_outside/max_over.expected    2014-08-04 23:15:33 +0900 (7fc2b23)
@@ -0,0 +1,61 @@
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users age COLUMN_SCALAR Int32
+[[0,0.0,0.0],true]
+table_create Ages TABLE_PAT_KEY Int32
+[[0,0.0,0.0],true]
+column_create Ages users_age COLUMN_INDEX Users age
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+[[0,0.0,0.0],5]
+select Users --filter 'between(age, 18, "exclude", 22, "exclude")'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        3
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "age",
+          "Int32"
+        ]
+      ],
+      [
+        3,
+        "calros",
+        19
+      ],
+      [
+        4,
+        "dave",
+        20
+      ],
+      [
+        5,
+        "eric",
+        21
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/between/with_index/range_outside/max_over.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/with_index/range_outside/max_over.test    2014-08-04 23:15:33 +0900 (d8fa40c)
@@ -0,0 +1,16 @@
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users age COLUMN_SCALAR Int32
+
+table_create Ages TABLE_PAT_KEY Int32
+column_create Ages users_age COLUMN_INDEX Users age
+
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+
+select Users --filter 'between(age, 18, "exclude", 22, "exclude")'

  Added: test/command/suite/select/function/between/with_index/range_outside/min_less.expected (+61 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/with_index/range_outside/min_less.expected    2014-08-04 23:15:33 +0900 (8d2f7fe)
@@ -0,0 +1,61 @@
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users age COLUMN_SCALAR Int32
+[[0,0.0,0.0],true]
+table_create Ages TABLE_PAT_KEY Int32
+[[0,0.0,0.0],true]
+column_create Ages users_age COLUMN_INDEX Users age
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+[[0,0.0,0.0],5]
+select Users --filter 'between(age, 16, "exclude", 20, "exclude")'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        3
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "age",
+          "Int32"
+        ]
+      ],
+      [
+        1,
+        "alice",
+        17
+      ],
+      [
+        2,
+        "bob",
+        18
+      ],
+      [
+        3,
+        "calros",
+        19
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/between/with_index/range_outside/min_less.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/with_index/range_outside/min_less.test    2014-08-04 23:15:33 +0900 (d3440d0)
@@ -0,0 +1,16 @@
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users age COLUMN_SCALAR Int32
+
+table_create Ages TABLE_PAT_KEY Int32
+column_create Ages users_age COLUMN_INDEX Users age
+
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+
+select Users --filter 'between(age, 16, "exclude", 20, "exclude")'

  Added: test/command/suite/select/function/between/with_index/range_outside/min_less_and_max_over.expected (+71 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/with_index/range_outside/min_less_and_max_over.expected    2014-08-04 23:15:33 +0900 (b7e0975)
@@ -0,0 +1,71 @@
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users age COLUMN_SCALAR Int32
+[[0,0.0,0.0],true]
+table_create Ages TABLE_PAT_KEY Int32
+[[0,0.0,0.0],true]
+column_create Ages users_age COLUMN_INDEX Users age
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+[[0,0.0,0.0],5]
+select Users --filter 'between(age, 16, "exclude", 22, "exclude")'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        5
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "age",
+          "Int32"
+        ]
+      ],
+      [
+        1,
+        "alice",
+        17
+      ],
+      [
+        2,
+        "bob",
+        18
+      ],
+      [
+        3,
+        "calros",
+        19
+      ],
+      [
+        4,
+        "dave",
+        20
+      ],
+      [
+        5,
+        "eric",
+        21
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/between/with_index/range_outside/min_less_and_max_over.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/with_index/range_outside/min_less_and_max_over.test    2014-08-04 23:15:33 +0900 (e9e8c2e)
@@ -0,0 +1,16 @@
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users age COLUMN_SCALAR Int32
+
+table_create Ages TABLE_PAT_KEY Int32
+column_create Ages users_age COLUMN_INDEX Users age
+
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+
+select Users --filter 'between(age, 16, "exclude", 22, "exclude")'

  Added: test/command/suite/select/function/between/without_index/range_outside/max_over.expected (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/without_index/range_outside/max_over.expected    2014-08-04 23:15:33 +0900 (0efa543)
@@ -0,0 +1,57 @@
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users age COLUMN_SCALAR Int32
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+[[0,0.0,0.0],5]
+select Users --filter 'between(age, 18, "exclude", 22, "exclude")'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        3
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "age",
+          "Int32"
+        ]
+      ],
+      [
+        3,
+        "calros",
+        19
+      ],
+      [
+        4,
+        "dave",
+        20
+      ],
+      [
+        5,
+        "eric",
+        21
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/between/without_index/range_outside/max_over.test (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/without_index/range_outside/max_over.test    2014-08-04 23:15:33 +0900 (bbbdf28)
@@ -0,0 +1,13 @@
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users age COLUMN_SCALAR Int32
+
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+
+select Users --filter 'between(age, 18, "exclude", 22, "exclude")'

  Added: test/command/suite/select/function/between/without_index/range_outside/min_less.expected (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/without_index/range_outside/min_less.expected    2014-08-04 23:15:33 +0900 (a2ff556)
@@ -0,0 +1,57 @@
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users age COLUMN_SCALAR Int32
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+[[0,0.0,0.0],5]
+select Users --filter 'between(age, 16, "exclude", 20, "exclude")'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        3
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "age",
+          "Int32"
+        ]
+      ],
+      [
+        1,
+        "alice",
+        17
+      ],
+      [
+        2,
+        "bob",
+        18
+      ],
+      [
+        3,
+        "calros",
+        19
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/between/without_index/range_outside/min_less.test (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/without_index/range_outside/min_less.test    2014-08-04 23:15:33 +0900 (25601bd)
@@ -0,0 +1,13 @@
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users age COLUMN_SCALAR Int32
+
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+
+select Users --filter 'between(age, 16, "exclude", 20, "exclude")'

  Added: test/command/suite/select/function/between/without_index/range_outside/min_less_and_max_over.expected (+67 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/without_index/range_outside/min_less_and_max_over.expected    2014-08-04 23:15:33 +0900 (1983fb0)
@@ -0,0 +1,67 @@
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users age COLUMN_SCALAR Int32
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+[[0,0.0,0.0],5]
+select Users --filter 'between(age, 16, "exclude", 22, "exclude")'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        5
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "age",
+          "Int32"
+        ]
+      ],
+      [
+        1,
+        "alice",
+        17
+      ],
+      [
+        2,
+        "bob",
+        18
+      ],
+      [
+        3,
+        "calros",
+        19
+      ],
+      [
+        4,
+        "dave",
+        20
+      ],
+      [
+        5,
+        "eric",
+        21
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/function/between/without_index/range_outside/min_less_and_max_over.test (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/between/without_index/range_outside/min_less_and_max_over.test    2014-08-04 23:15:33 +0900 (6cc545e)
@@ -0,0 +1,13 @@
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users age COLUMN_SCALAR Int32
+
+load --table Users
+[
+{"_key": "alice",  "age": 17},
+{"_key": "bob",    "age": 18},
+{"_key": "calros", "age": 19},
+{"_key": "dave",   "age": 20},
+{"_key": "eric",   "age": 21}
+]
+
+select Users --filter 'between(age, 16, "exclude", 22, "exclude")'
-------------- next part --------------
HTML����������������������������...
Download 



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