should be it

This commit is contained in:
2025-10-24 19:21:19 -05:00
parent a4b23fc57c
commit f09560c7b1
14047 changed files with 3161551 additions and 1 deletions

View 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

View 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

View 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