Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from naoa/test-between-over-case
test: add test case for optimized between specify outside of key range Patch by Naoya Murakami. Thanks!!!
- Loading branch information
Showing
8 changed files
with
326 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
mysql-test/mroonga/storage/optimization/order_limit/optimized/datetime/r/between_over.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| DROP TABLE IF EXISTS diaries; | ||
| FLUSH STATUS; | ||
| SET NAMES UTF8; | ||
| CREATE TABLE diaries ( | ||
| id INT UNSIGNED NOT NULL, | ||
| date DATETIME, | ||
| content TEXT, | ||
| FULLTEXT INDEX(content), | ||
| KEY(date) | ||
| ) DEFAULT CHARSET UTF8; | ||
| SHOW CREATE TABLE diaries; | ||
| Table Create Table | ||
| diaries CREATE TABLE `diaries` ( | ||
| `id` int(10) unsigned NOT NULL, | ||
| `date` datetime DEFAULT NULL, | ||
| `content` text, | ||
| KEY `date` (`date`), | ||
| FULLTEXT KEY `content` (`content`) | ||
| ) ENGINE=mroonga DEFAULT CHARSET=utf8 | ||
| INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); | ||
| INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); | ||
| INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); | ||
| INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); | ||
| INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); | ||
| SELECT * FROM diaries | ||
| WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND | ||
| date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:43" | ||
| ORDER BY id LIMIT 1,2; | ||
| id date content | ||
| 3 2011-11-11 12:23:32 I will do something today! | ||
| 4 2011-11-11 12:23:33 I don't want to anything today... | ||
| SHOW STATUS LIKE 'mroonga_fast_order_limit'; | ||
| Variable_name Value | ||
| Mroonga_fast_order_limit 1 | ||
| DROP TABLE diaries; |
50 changes: 50 additions & 0 deletions
50
mysql-test/mroonga/storage/optimization/order_limit/optimized/datetime/t/between_over.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com> | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2.1 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| --source ../../../../../../include/mroonga/have_mroonga.inc | ||
|
|
||
| --disable_warnings | ||
| DROP TABLE IF EXISTS diaries; | ||
| --enable_warnings | ||
|
|
||
| FLUSH STATUS; | ||
|
|
||
| SET NAMES UTF8; | ||
| CREATE TABLE diaries ( | ||
| id INT UNSIGNED NOT NULL, | ||
| date DATETIME, | ||
| content TEXT, | ||
| FULLTEXT INDEX(content), | ||
| KEY(date) | ||
| ) DEFAULT CHARSET UTF8; | ||
| SHOW CREATE TABLE diaries; | ||
|
|
||
| INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); | ||
| INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); | ||
| INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); | ||
| INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); | ||
| INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); | ||
|
|
||
| SELECT * FROM diaries | ||
| WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND | ||
| date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:43" | ||
| ORDER BY id LIMIT 1,2; | ||
|
|
||
| SHOW STATUS LIKE 'mroonga_fast_order_limit'; | ||
|
|
||
| DROP TABLE diaries; | ||
|
|
||
| --source ../../../../../../include/mroonga/have_mroonga_deinit.inc |
25 changes: 25 additions & 0 deletions
25
mysql-test/mroonga/storage/optimization/order_limit/optimized/int/r/between_over.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| DROP TABLE IF EXISTS memos; | ||
| FLUSH STATUS; | ||
| SET NAMES UTF8; | ||
| CREATE TABLE memos ( | ||
| id INT UNSIGNED, | ||
| content TEXT, | ||
| FULLTEXT INDEX(content), | ||
| KEY(id) | ||
| ) DEFAULT CHARSET UTF8; | ||
| INSERT INTO memos VALUES(1, "Today is fine."); | ||
| INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); | ||
| INSERT INTO memos VALUES(3, "I will do something today!"); | ||
| INSERT INTO memos VALUES(4, "I don't want to anything today..."); | ||
| INSERT INTO memos VALUES(5, "I'm sleepy today."); | ||
| SELECT * FROM memos | ||
| WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND | ||
| id BETWEEN 2 AND 6 | ||
| ORDER BY id LIMIT 1,2; | ||
| id content | ||
| 3 I will do something today! | ||
| 4 I don't want to anything today... | ||
| SHOW STATUS LIKE 'mroonga_fast_order_limit'; | ||
| Variable_name Value | ||
| Mroonga_fast_order_limit 1 | ||
| DROP TABLE memos; |
48 changes: 48 additions & 0 deletions
48
mysql-test/mroonga/storage/optimization/order_limit/optimized/int/t/between_over.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com> | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2.1 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| --source ../../../../../../include/mroonga/have_mroonga.inc | ||
|
|
||
| --disable_warnings | ||
| DROP TABLE IF EXISTS memos; | ||
| --enable_warnings | ||
|
|
||
| FLUSH STATUS; | ||
|
|
||
| SET NAMES UTF8; | ||
| CREATE TABLE memos ( | ||
| id INT UNSIGNED, | ||
| content TEXT, | ||
| FULLTEXT INDEX(content), | ||
| KEY(id) | ||
| ) DEFAULT CHARSET UTF8; | ||
|
|
||
| INSERT INTO memos VALUES(1, "Today is fine."); | ||
| INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); | ||
| INSERT INTO memos VALUES(3, "I will do something today!"); | ||
| INSERT INTO memos VALUES(4, "I don't want to anything today..."); | ||
| INSERT INTO memos VALUES(5, "I'm sleepy today."); | ||
|
|
||
| SELECT * FROM memos | ||
| WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND | ||
| id BETWEEN 2 AND 6 | ||
| ORDER BY id LIMIT 1,2; | ||
|
|
||
| SHOW STATUS LIKE 'mroonga_fast_order_limit'; | ||
|
|
||
| DROP TABLE memos; | ||
|
|
||
| --source ../../../../../../include/mroonga/have_mroonga_deinit.inc |
35 changes: 35 additions & 0 deletions
35
mysql-test/mroonga/storage/optimization/order_limit/optimized/time/r/between_over.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| DROP TABLE IF EXISTS memos; | ||
| FLUSH STATUS; | ||
| SET NAMES UTF8; | ||
| CREATE TABLE memos ( | ||
| id INT UNSIGNED NOT NULL, | ||
| writing_time TIME, | ||
| content TEXT, | ||
| FULLTEXT INDEX(content), | ||
| KEY(writing_time) | ||
| ) DEFAULT CHARSET UTF8; | ||
| SHOW CREATE TABLE memos; | ||
| Table Create Table | ||
| memos CREATE TABLE `memos` ( | ||
| `id` int(10) unsigned NOT NULL, | ||
| `writing_time` time DEFAULT NULL, | ||
| `content` text, | ||
| KEY `writing_time` (`writing_time`), | ||
| FULLTEXT KEY `content` (`content`) | ||
| ) ENGINE=mroonga DEFAULT CHARSET=utf8 | ||
| INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); | ||
| INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); | ||
| INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); | ||
| INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); | ||
| INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); | ||
| SELECT * FROM memos | ||
| WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND | ||
| writing_time BETWEEN "1:23:31" AND "1:23:43" | ||
| ORDER BY id LIMIT 1,2; | ||
| id writing_time content | ||
| 3 01:23:32 I will do something today! | ||
| 4 01:23:33 I don't want to anything today... | ||
| SHOW STATUS LIKE 'mroonga_fast_order_limit'; | ||
| Variable_name Value | ||
| Mroonga_fast_order_limit 1 | ||
| DROP TABLE memos; |
50 changes: 50 additions & 0 deletions
50
mysql-test/mroonga/storage/optimization/order_limit/optimized/time/t/between_over.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com> | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2.1 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| --source ../../../../../../include/mroonga/have_mroonga.inc | ||
|
|
||
| --disable_warnings | ||
| DROP TABLE IF EXISTS memos; | ||
| --enable_warnings | ||
|
|
||
| FLUSH STATUS; | ||
|
|
||
| SET NAMES UTF8; | ||
| CREATE TABLE memos ( | ||
| id INT UNSIGNED NOT NULL, | ||
| writing_time TIME, | ||
| content TEXT, | ||
| FULLTEXT INDEX(content), | ||
| KEY(writing_time) | ||
| ) DEFAULT CHARSET UTF8; | ||
| SHOW CREATE TABLE memos; | ||
|
|
||
| INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); | ||
| INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); | ||
| INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); | ||
| INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); | ||
| INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); | ||
|
|
||
| SELECT * FROM memos | ||
| WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND | ||
| writing_time BETWEEN "1:23:31" AND "1:23:43" | ||
| ORDER BY id LIMIT 1,2; | ||
|
|
||
| SHOW STATUS LIKE 'mroonga_fast_order_limit'; | ||
|
|
||
| DROP TABLE memos; | ||
|
|
||
| --source ../../../../../../include/mroonga/have_mroonga_deinit.inc |
30 changes: 30 additions & 0 deletions
30
mysql-test/mroonga/storage/optimization/order_limit/optimized/year/r/between_over.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| DROP TABLE IF EXISTS mroonga_releases; | ||
| FLUSH STATUS; | ||
| CREATE TABLE mroonga_releases ( | ||
| id INT PRIMARY KEY AUTO_INCREMENT, | ||
| release_title TEXT, | ||
| release_year YEAR, | ||
| KEY (release_year), | ||
| FULLTEXT KEY (release_title) | ||
| ) DEFAULT CHARSET UTF8; | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Groonga storage engine 0.1 has been released", "10"); | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Rename Groonga storage engine to Mroonga", "2011"); | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Mroonga 2.0 has been released", "2012"); | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Mroonga 3.0 has been released", "13"); | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Mroonga 4.0 will be released", "2014"); | ||
| SELECT * FROM mroonga_releases | ||
| WHERE release_year BETWEEN "11" AND "2015" AND | ||
| MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) | ||
| ORDER BY id DESC LIMIT 1,2; | ||
| id release_title release_year | ||
| 4 Mroonga 3.0 has been released 2013 | ||
| 3 Mroonga 2.0 has been released 2012 | ||
| SHOW STATUS LIKE 'mroonga_fast_order_limit'; | ||
| Variable_name Value | ||
| Mroonga_fast_order_limit 1 | ||
| DROP TABLE mroonga_releases; |
53 changes: 53 additions & 0 deletions
53
mysql-test/mroonga/storage/optimization/order_limit/optimized/year/t/between_over.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Copyright(C) 2013 Kentoku SHIBA | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2.1 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| --source ../../../../../../include/mroonga/have_mroonga.inc | ||
|
|
||
| --disable_warnings | ||
| DROP TABLE IF EXISTS mroonga_releases; | ||
| --enable_warnings | ||
|
|
||
| FLUSH STATUS; | ||
|
|
||
| CREATE TABLE mroonga_releases ( | ||
| id INT PRIMARY KEY AUTO_INCREMENT, | ||
| release_title TEXT, | ||
| release_year YEAR, | ||
| KEY (release_year), | ||
| FULLTEXT KEY (release_title) | ||
| ) DEFAULT CHARSET UTF8; | ||
|
|
||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Groonga storage engine 0.1 has been released", "10"); | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Rename Groonga storage engine to Mroonga", "2011"); | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Mroonga 2.0 has been released", "2012"); | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Mroonga 3.0 has been released", "13"); | ||
| INSERT INTO mroonga_releases (release_title, release_year) | ||
| VALUES ("Mroonga 4.0 will be released", "2014"); | ||
|
|
||
| SELECT * FROM mroonga_releases | ||
| WHERE release_year BETWEEN "11" AND "2015" AND | ||
| MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) | ||
| ORDER BY id DESC LIMIT 1,2; | ||
|
|
||
| SHOW STATUS LIKE 'mroonga_fast_order_limit'; | ||
|
|
||
| DROP TABLE mroonga_releases; | ||
|
|
||
| --source ../../../../../../include/mroonga/have_mroonga_deinit.inc |