Kouhei Sutou
null+****@clear*****
Wed Sep 23 20:19:02 JST 2015
Kouhei Sutou 2015-09-23 20:19:02 +0900 (Wed, 23 Sep 2015) New Revision: 2b39467a79159764f70028d857f7449af34a7d7c https://github.com/pgroonga/pgroonga/commit/2b39467a79159764f70028d857f7449af34a7d7c Message: json test: add tests for element value Added files: expected/jsonb/element/boolean/bitmapscan.out expected/jsonb/element/boolean/indexscan.out expected/jsonb/element/number/bitmapscan.out expected/jsonb/element/number/indexscan.out expected/jsonb/element/string/bitmapscan.out expected/jsonb/element/string/indexscan.out sql/jsonb/element/boolean/bitmapscan.sql sql/jsonb/element/boolean/indexscan.sql sql/jsonb/element/number/bitmapscan.sql sql/jsonb/element/number/indexscan.sql sql/jsonb/element/string/bitmapscan.sql sql/jsonb/element/string/indexscan.sql Added: expected/jsonb/element/boolean/bitmapscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/element/boolean/bitmapscan.out 2015-09-23 20:19:02 +0900 (8ae422d) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '[true]'); +INSERT INTO fruits VALUES (2, '[false]'); +INSERT INTO fruits VALUES (3, '[true]'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; +SELECT id, items + FROM fruits + WHERE items @@ 'boolean == true' + ORDER BY id; + id | items +----+-------- + 1 | [true] + 3 | [true] +(2 rows) + +DROP TABLE fruits; Added: expected/jsonb/element/boolean/indexscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/element/boolean/indexscan.out 2015-09-23 20:19:02 +0900 (519a44e) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '[true]'); +INSERT INTO fruits VALUES (2, '[false]'); +INSERT INTO fruits VALUES (3, '[true]'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; +SELECT id, items + FROM fruits + WHERE items @@ 'boolean == true' + ORDER BY id; + id | items +----+-------- + 1 | [true] + 3 | [true] +(2 rows) + +DROP TABLE fruits; Added: expected/jsonb/element/number/bitmapscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/element/number/bitmapscan.out 2015-09-23 20:19:02 +0900 (975c3e5) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '[100]'); +INSERT INTO fruits VALUES (2, '[200, 30]'); +INSERT INTO fruits VALUES (3, '[150]'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; +SELECT id, items + FROM fruits + WHERE items @@ 'number <= 100' + ORDER BY id; + id | items +----+----------- + 1 | [100] + 2 | [200, 30] +(2 rows) + +DROP TABLE fruits; Added: expected/jsonb/element/number/indexscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/element/number/indexscan.out 2015-09-23 20:19:02 +0900 (c8dc8a7) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '[100]'); +INSERT INTO fruits VALUES (2, '[200, 30]'); +INSERT INTO fruits VALUES (3, '[150]'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; +SELECT id, items + FROM fruits + WHERE items @@ 'number <= 100' + ORDER BY id; + id | items +----+----------- + 1 | [100] + 2 | [200, 30] +(2 rows) + +DROP TABLE fruits; Added: expected/jsonb/element/string/bitmapscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/element/string/bitmapscan.out 2015-09-23 20:19:02 +0900 (2258ddb) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '["apple"]'); +INSERT INTO fruits VALUES (2, '["banana", "apple"]'); +INSERT INTO fruits VALUES (3, '["peach"]'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; +SELECT id, items + FROM fruits + WHERE items @@ 'string == "apple"' + ORDER BY id; + id | items +----+--------------------- + 1 | ["apple"] + 2 | ["banana", "apple"] +(2 rows) + +DROP TABLE fruits; Added: expected/jsonb/element/string/indexscan.out (+22 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/element/string/indexscan.out 2015-09-23 20:19:02 +0900 (7e2c99c) @@ -0,0 +1,22 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '["apple"]'); +INSERT INTO fruits VALUES (2, '["banana", "apple"]'); +INSERT INTO fruits VALUES (3, '["peach"]'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; +SELECT id, items + FROM fruits + WHERE items @@ 'string == "apple"' + ORDER BY id; + id | items +----+--------------------- + 1 | ["apple"] + 2 | ["banana", "apple"] +(2 rows) + +DROP TABLE fruits; Added: sql/jsonb/element/boolean/bitmapscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/element/boolean/bitmapscan.sql 2015-09-23 20:19:02 +0900 (9bc3302) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '[true]'); +INSERT INTO fruits VALUES (2, '[false]'); +INSERT INTO fruits VALUES (3, '[true]'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); + +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; + +SELECT id, items + FROM fruits + WHERE items @@ 'boolean == true' + ORDER BY id; + +DROP TABLE fruits; Added: sql/jsonb/element/boolean/indexscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/element/boolean/indexscan.sql 2015-09-23 20:19:02 +0900 (0720773) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '[true]'); +INSERT INTO fruits VALUES (2, '[false]'); +INSERT INTO fruits VALUES (3, '[true]'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); + +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; + +SELECT id, items + FROM fruits + WHERE items @@ 'boolean == true' + ORDER BY id; + +DROP TABLE fruits; Added: sql/jsonb/element/number/bitmapscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/element/number/bitmapscan.sql 2015-09-23 20:19:02 +0900 (e4544ce) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '[100]'); +INSERT INTO fruits VALUES (2, '[200, 30]'); +INSERT INTO fruits VALUES (3, '[150]'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); + +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; + +SELECT id, items + FROM fruits + WHERE items @@ 'number <= 100' + ORDER BY id; + +DROP TABLE fruits; Added: sql/jsonb/element/number/indexscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/element/number/indexscan.sql 2015-09-23 20:19:02 +0900 (7cf95f5) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '[100]'); +INSERT INTO fruits VALUES (2, '[200, 30]'); +INSERT INTO fruits VALUES (3, '[150]'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); + +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; + +SELECT id, items + FROM fruits + WHERE items @@ 'number <= 100' + ORDER BY id; + +DROP TABLE fruits; Added: sql/jsonb/element/string/bitmapscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/element/string/bitmapscan.sql 2015-09-23 20:19:02 +0900 (1343f1a) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '["apple"]'); +INSERT INTO fruits VALUES (2, '["banana", "apple"]'); +INSERT INTO fruits VALUES (3, '["peach"]'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); + +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; + +SELECT id, items + FROM fruits + WHERE items @@ 'string == "apple"' + ORDER BY id; + +DROP TABLE fruits; Added: sql/jsonb/element/string/indexscan.sql (+21 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/element/string/indexscan.sql 2015-09-23 20:19:02 +0900 (3829339) @@ -0,0 +1,21 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '["apple"]'); +INSERT INTO fruits VALUES (2, '["banana", "apple"]'); +INSERT INTO fruits VALUES (3, '["peach"]'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); + +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; + +SELECT id, items + FROM fruits + WHERE items @@ 'string == "apple"' + ORDER BY id; + +DROP TABLE fruits; -------------- next part -------------- HTML����������������������������...Download