should be it
This commit is contained in:
54
external/duckdb/test/sql/index/art/multi_column/test_art_multi_column.test
vendored
Normal file
54
external/duckdb/test/sql/index/art/multi_column/test_art_multi_column.test
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# name: test/sql/index/art/multi_column/test_art_multi_column.test
|
||||
# description: Test ART index on table with multiple columns
|
||||
# group: [multi_column]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers(i BIGINT, j INTEGER, k VARCHAR)
|
||||
|
||||
statement ok
|
||||
CREATE INDEX i_index ON integers using art(j)
|
||||
|
||||
statement ok
|
||||
INSERT INTO integers VALUES (10, 1, 'hello'), (11, 2, 'world')
|
||||
|
||||
# condition on "i"
|
||||
query I
|
||||
SELECT i FROM integers WHERE i=10
|
||||
----
|
||||
10
|
||||
|
||||
query IIT
|
||||
SELECT * FROM integers WHERE i=10
|
||||
----
|
||||
10 1 hello
|
||||
|
||||
# condition on "j"
|
||||
query I
|
||||
SELECT j FROM integers WHERE j=1
|
||||
----
|
||||
1
|
||||
|
||||
query IIT
|
||||
SELECT * FROM integers WHERE j=1
|
||||
----
|
||||
10 1 hello
|
||||
|
||||
# condition on "k"
|
||||
query T
|
||||
SELECT k FROM integers WHERE k='hello'
|
||||
----
|
||||
hello
|
||||
|
||||
query IT
|
||||
SELECT i, k FROM integers WHERE k='hello'
|
||||
----
|
||||
10 hello
|
||||
|
||||
query IIT
|
||||
SELECT * FROM integers WHERE k='hello'
|
||||
----
|
||||
10 1 hello
|
||||
|
||||
88
external/duckdb/test/sql/index/art/multi_column/test_art_multi_column.test_slow
vendored
Normal file
88
external/duckdb/test/sql/index/art/multi_column/test_art_multi_column.test_slow
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
# name: test/sql/index/art/multi_column/test_art_multi_column.test_slow
|
||||
# description: Test ART index on table with multiple columns and connections
|
||||
# group: [multi_column]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
require skip_reload
|
||||
|
||||
# create a table
|
||||
statement ok con1
|
||||
CREATE TABLE integers(i INTEGER, j INTEGER);
|
||||
|
||||
statement ok con1
|
||||
CREATE INDEX i_index ON integers using art(i);
|
||||
|
||||
statement ok con1
|
||||
INSERT INTO integers VALUES (1, 3);
|
||||
|
||||
loop i 0 3000
|
||||
|
||||
query I
|
||||
SELECT COUNT(*) FROM integers WHERE i=${i} + 10;
|
||||
----
|
||||
0
|
||||
|
||||
statement ok
|
||||
INSERT INTO integers VALUES (${i} + 10, ${i} + 12);
|
||||
|
||||
query I
|
||||
SELECT COUNT(*) FROM integers WHERE i=${i} + 10;
|
||||
----
|
||||
1
|
||||
|
||||
endloop
|
||||
|
||||
# both con and con2 start a transaction
|
||||
statement ok con1
|
||||
BEGIN TRANSACTION
|
||||
|
||||
statement ok con2
|
||||
BEGIN TRANSACTION
|
||||
|
||||
# con2 updates the integers array before index creation
|
||||
statement ok con2
|
||||
UPDATE integers SET i=4 WHERE i=1
|
||||
|
||||
# con should see the old state
|
||||
query I con1
|
||||
SELECT j FROM integers WHERE i=1
|
||||
----
|
||||
3
|
||||
|
||||
# con2 should see the updated state
|
||||
query I con2
|
||||
SELECT j FROM integers WHERE i=4
|
||||
----
|
||||
3
|
||||
|
||||
# now we commit con
|
||||
statement ok con1
|
||||
COMMIT
|
||||
|
||||
# con should still see the old state
|
||||
query I con1
|
||||
SELECT j FROM integers WHERE i=1
|
||||
----
|
||||
3
|
||||
|
||||
statement ok con2
|
||||
COMMIT
|
||||
|
||||
# after commit of con2 - con should see the old state
|
||||
query I con1
|
||||
SELECT j FROM integers WHERE i=4
|
||||
----
|
||||
3
|
||||
|
||||
# now we update the index again, this time after index creation
|
||||
statement ok con2
|
||||
UPDATE integers SET i=7 WHERE i=4
|
||||
|
||||
# the new state should be visible
|
||||
query I con1
|
||||
SELECT j FROM integers WHERE i=7
|
||||
----
|
||||
3
|
||||
|
||||
21
external/duckdb/test/sql/index/art/multi_column/test_art_multi_predicate.test
vendored
Normal file
21
external/duckdb/test/sql/index/art/multi_column/test_art_multi_predicate.test
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# name: test/sql/index/art/multi_column/test_art_multi_predicate.test
|
||||
# description: Test a point lookup with multiple predicates
|
||||
# group: [multi_column]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers(i INTEGER, j INTEGER)
|
||||
|
||||
statement ok
|
||||
CREATE INDEX i_index ON integers using art(i)
|
||||
|
||||
statement ok
|
||||
INSERT INTO integers VALUES (1, 2), (1, 3)
|
||||
|
||||
query II
|
||||
SELECT * FROM integers WHERE i = 1 AND j = 2
|
||||
----
|
||||
1 2
|
||||
|
||||
Reference in New Issue
Block a user