null+****@clear*****
null+****@clear*****
2011年 12月 12日 (月) 16:19:14 JST
Kouhei Sutou 2011-12-12 07:19:14 +0000 (Mon, 12 Dec 2011)
New Revision: c5f6dc404173cff178277e976327fb5f1b29bd40
Log:
[test][wrapper] add a test for count(*) with index. refs #1196
This test fails for now.
Reported by Kaneoka. Thanks!!!
Added files:
test/sql/suite/groonga_wrapper/r/count_star_index.result
test/sql/suite/groonga_wrapper/t/count_star_index.test
Added: test/sql/suite/groonga_wrapper/r/count_star_index.result (+28 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/groonga_wrapper/r/count_star_index.result 2011-12-12 07:19:14 +0000 (6b29be5)
@@ -0,0 +1,28 @@
+DROP TABLE IF EXISTS diaries_innodb;
+DROP TABLE IF EXISTS diaries_mroonga;
+CREATE TABLE diaries_innodb (
+id INT PRIMARY KEY AUTO_INCREMENT,
+body TEXT,
+flag TINYINT(2),
+INDEX (flag)
+) ENGINE = InnoDB DEFAULT CHARSET UTF8;
+CREATE TABLE diaries_mroonga (
+id INT PRIMARY KEY AUTO_INCREMENT,
+body TEXT,
+flag TINYINT(2),
+INDEX (flag)
+) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8;
+INSERT INTO diaries_innodb (body) VALUES ("will start groonga!");
+INSERT INTO diaries_innodb (body) VALUES ("starting groonga...");
+INSERT INTO diaries_innodb (body) VALUES ("started groonga.");
+INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!");
+INSERT INTO diaries_mroonga (body) VALUES ("starting groonga...");
+INSERT INTO diaries_mroonga (body) VALUES ("started groonga.");
+EXPLAIN SELECT COUNT(*) FROM diaries_innodb;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE diaries_innodb index NULL flag 2 NULL 3 Using index
+EXPLAIN SELECT COUNT(*) FROM diaries_mroonga;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE diaries_mroonga index NULL flag 2 NULL 3 Using index
+DROP TABLE diaries_innodb;
+DROP TABLE diaries_mroonga;
Added: test/sql/suite/groonga_wrapper/t/count_star_index.test (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/groonga_wrapper/t/count_star_index.test 2011-12-12 07:19:14 +0000 (a0879e6)
@@ -0,0 +1,53 @@
+# Copyright(C) 2011 Kouhei Sutou <kou****@clear*****>
+#
+# 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/have_fulltext_index_comment.inc
+--source include/have_groonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS diaries_innodb;
+DROP TABLE IF EXISTS diaries_mroonga;
+--enable_warnings
+
+CREATE TABLE diaries_innodb (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ body TEXT,
+ flag TINYINT(2),
+ INDEX (flag)
+) ENGINE = InnoDB DEFAULT CHARSET UTF8;
+
+CREATE TABLE diaries_mroonga (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ body TEXT,
+ flag TINYINT(2),
+ INDEX (flag)
+) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8;
+
+INSERT INTO diaries_innodb (body) VALUES ("will start groonga!");
+INSERT INTO diaries_innodb (body) VALUES ("starting groonga...");
+INSERT INTO diaries_innodb (body) VALUES ("started groonga.");
+
+INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!");
+INSERT INTO diaries_mroonga (body) VALUES ("starting groonga...");
+INSERT INTO diaries_mroonga (body) VALUES ("started groonga.");
+
+EXPLAIN SELECT COUNT(*) FROM diaries_innodb;
+EXPLAIN SELECT COUNT(*) FROM diaries_mroonga;
+
+DROP TABLE diaries_innodb;
+DROP TABLE diaries_mroonga;
+
+--source include/have_groonga_deinit.inc