Skip to content

Commit

Permalink
Drop sqllogictest created table (#1113)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Drop sqllogictest created table

### Type of change

- [x] Test cases

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
  • Loading branch information
JinHai-CN authored Apr 25, 2024
1 parent ab8b572 commit e0579ea
Show file tree
Hide file tree
Showing 31 changed files with 104 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/unit_test/executor/pipeline/fragment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,10 @@ TEST_F(FragmentTest, test_build_fragment) {
EXPECT_EQ(result7->definition_ptr_->column_count(), 8u);
auto result8 = SQLRunner::Run("show table t2", true);
EXPECT_EQ(result8->definition_ptr_->column_count(), 2u);

/// DDL
auto result9 = SQLRunner::Run("drop table t3", true);
EXPECT_EQ(result9->definition_ptr_.get()->columns()[0]->name_, "OK");
auto result10 = SQLRunner::Run("drop table t2", true);
EXPECT_EQ(result9->definition_ptr_.get()->columns()[0]->name_, "OK");
}
2 changes: 2 additions & 0 deletions test/sql/ddl/index/test_annivfflat.slt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ DROP INDEX idx1 ON test_annivfflat;
statement ok
CREATE INDEX idx2 ON test_annivfflat (col1) USING IVFFlat WITH (metric = l2);

statement ok
DROP TABLE test_annivfflat;
2 changes: 2 additions & 0 deletions test/sql/ddl/index/test_hnsw.slt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ CREATE INDEX idx2 ON test_hnsw (col1) USING Hnsw WITH (metric = l2);
statement ok
CREATE INDEX IF NOT EXISTS idx2 ON test_hnsw (col1) USING Hnsw WITH (metric = l2);

statement ok
DROP TABLE test_hnsw;
3 changes: 3 additions & 0 deletions test/sql/ddl/index/test_index.slt
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ DROP INDEX idx1 ON test_index;

statement ok
CREATE INDEX idx1 ON test_index (col1) USING IVFFlat WITH (centroids_count = 128, metric = l2);

statement ok
DROP TABLE test_index;
3 changes: 3 additions & 0 deletions test/sql/dml/compact/test_compact.slt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ SELECT * FROM test_compact;
1 2,3,4
5 6,7,8
9 10,11,12

statement ok
DROP TABLE test_compact;
3 changes: 3 additions & 0 deletions test/sql/dml/compact/test_compact_import_insert.slt
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ SELECT * FROM test_compact_import_delete;
5 6,7,8
9 10,11,12
9 10,11,12

statement ok
DROP TABLE test_compact_import_delete;
5 changes: 4 additions & 1 deletion test/sql/dml/compact/test_compact_with_delete.slt
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ SELECT * FROM test_compact_with_delete;
5 6,7,8
9 10,11,12
5 6,7,8
9 10,11,12
9 10,11,12

statement ok
DROP TABLE test_compact_with_delete;
3 changes: 3 additions & 0 deletions test/sql/dml/compact/test_compact_with_index.slt
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ SELECT c1 FROM test_compact_with_index SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'flo
8
8
8

statement ok
DROP TABLE test_compact_with_index;
3 changes: 3 additions & 0 deletions test/sql/dml/delete/test_delete_with_hnsw.slt
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ SELECT c1 FROM test_delete_with_hnsw SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'float
6
4
4

statement ok
DROP TABLE test_delete_with_hnsw;
3 changes: 3 additions & 0 deletions test/sql/dml/insert/test_insert_embedding.slt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ query II
SELECT * FROM test_insert_embedding;
----
0 0.1,1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1

statement ok
DROP TABLE test_insert_embedding;
3 changes: 3 additions & 0 deletions test/sql/dml/update.slt
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ CREATE TABLE T2 (c1 boolean, c2 boolean);

statement error
UPDATE t2 SET c1 = 1 WHERE c2 = true;

statement ok
DROP TABLE T2;
2 changes: 2 additions & 0 deletions test/sql/dql/knn/test_knn_annivfflat_ip.slt
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ SELECT c1 FROM test_knn_annivfflat_ip SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'floa
8
8

statement ok
DROP TABLE test_knn_annivfflat_ip;
5 changes: 4 additions & 1 deletion test/sql/dql/knn/test_knn_annivfflat_ip_filter.slt
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,7 @@ SELECT c1 FROM test_knn_annivfflat_ip_filter SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2]
4
2
2
2
2

statement ok
DROP TABLE test_knn_annivfflat_ip_filter;
2 changes: 2 additions & 0 deletions test/sql/dql/knn/test_knn_annivfflat_l2.slt
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ SELECT c1 FROM test_knn_annivfflat_l2 SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'floa
8
8

statement ok
DROP TABLE test_knn_annivfflat_l2;
5 changes: 4 additions & 1 deletion test/sql/dql/knn/test_knn_annivfflat_l2_filter.slt
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,7 @@ SELECT c1 FROM test_knn_annivfflat_l2_filter SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2]
4
2
2
2
2

statement ok
DROP TABLE test_knn_annivfflat_l2_filter;
5 changes: 4 additions & 1 deletion test/sql/dql/knn/test_knn_hnsw_ip.slt
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ SELECT c1 FROM test_knn_hnsw_ip SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'float', 'i
----
8
8
8
8

statement ok
DROP TABLE test_knn_hnsw_ip;
5 changes: 4 additions & 1 deletion test/sql/dql/knn/test_knn_hnsw_ip_filter.slt
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,7 @@ SELECT c1 FROM test_knn_hnsw_ip_filter SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'flo
4
2
2
2
2

statement ok
DROP TABLE test_knn_hnsw_ip_filter;
2 changes: 2 additions & 0 deletions test/sql/dql/knn/test_knn_hnsw_l2.slt
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ SELECT c1 FROM test_knn_hnsw_l2 SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'float', 'l
8
8

statement ok
DROP TABLE test_knn_hnsw_l2;
5 changes: 4 additions & 1 deletion test/sql/dql/knn/test_knn_hnsw_l2_filter.slt
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,7 @@ SELECT c1 FROM test_knn_hnsw_l2_filter SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'flo
4
2
2
2
2

statement ok
DROP TABLE test_knn_hnsw_l2_filter;
3 changes: 3 additions & 0 deletions test/sql/dql/knn/test_knn_ip.slt
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ SELECT c1 FROM test_knn_ip SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'float', 'ip', 1
2
2
2

statement ok
DROP TABLE test_knn_ip;
5 changes: 4 additions & 1 deletion test/sql/dql/knn/test_knn_ip_filter.slt
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,7 @@ SELECT c1 FROM test_knn_ip_filter SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'float',
4
2
2
2
2

statement ok
DROP TABLE test_knn_ip_filter;
5 changes: 4 additions & 1 deletion test/sql/dql/knn/test_knn_l2.slt
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ SELECT c1 FROM test_knn_l2 SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'float', 'l2', 3
----
8
8
8
8

statement ok
DROP TABLE test_knn_l2;
5 changes: 4 additions & 1 deletion test/sql/dql/knn/test_knn_l2_filter.slt
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,7 @@ SELECT c1 FROM test_knn_l2_filter SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'float',
4
2
2
2
2

statement ok
DROP TABLE test_knn_l2_filter;
3 changes: 3 additions & 0 deletions test/sql/dql/knn/test_multi_thread.slt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ SELECT c1 FROM test_knn_hnsw_l2 SEARCH KNN(c2, [0.3, 0.3, 0.2, 0.2], 'float', 'l
8
8
8

statement ok
DROP TABLE test_knn_hnsw_l2;
5 changes: 4 additions & 1 deletion test/sql/dql/limit.slt
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,7 @@ SELECT * FROM test_limit order by c1 desc limit 2 offset 2;

query II
SELECT * FROM test_limit limit 2 offset 4;
----
----

statement ok
DROP TABLE test_limit;
2 changes: 2 additions & 0 deletions test/sql/dql/select.slt
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,5 @@ SELECT 'abccccccccccccccccccccccccccccccccccccccccc';
----
abccccccccccccccccccccccccccccccccccccccccc

statement ok
DROP TABLE select3;
4 changes: 4 additions & 0 deletions tools/generate_compact.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def generate(generate_if_exists: bool, copy_dir: str):
slt_file.write("{}\n".format(x1))
slt_file.write("\n")

slt_file.write("statement ok\n")
slt_file.write("DROP TABLE {};\n".format(table_name))
slt_file.write("\n")

pass


Expand Down
4 changes: 4 additions & 0 deletions tools/generate_hnsw_with_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ def find_nearest(delete_set: set[int]) -> dict[int, int]:
slt_file.write("{}\n".format(to_result_embedding(v_x)))
slt_file.write("\n")

slt_file.write("statement ok\n")
slt_file.write("DROP TABLE {};\n".format(table_name))
slt_file.write("\n")


if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate top data for test")
Expand Down
4 changes: 4 additions & 0 deletions tools/generate_many_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def generate(generate_if_exists: bool, copy_dir: str):
)
slt_file.write("\n")

slt_file.write("statement ok\n")
slt_file.write("DROP TABLE {};\n".format(table_name))
slt_file.write("\n")

# # The delete will throw exception when compacting, so add this to wait for sometime
# slt_file.write("statement ok\n")
# slt_file.write("SELECT * FROM {};\n".format(table_name))
Expand Down
3 changes: 3 additions & 0 deletions tools/generate_many_import_drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def generate(generate_if_exists: bool, copy_dir: str):
)
slt_file.write("\n")

slt_file.write("statement ok\n")
slt_file.write("DROP TABLE {};\n".format(table_name))
slt_file.write("\n")
# # The delete will throw exception when compacting, so add this to wait for sometime
# slt_file.write("statement ok\n")
# slt_file.write("SELECT * FROM {};\n".format(table_name))
Expand Down
4 changes: 4 additions & 0 deletions tools/generate_mem_hnsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def generate(generate_if_exist: bool, copy_dir: str):
slt_file.write("{}\n".format(row_id))
slt_file.write("\n")

slt_file.write("statement ok\n")
slt_file.write("DROP TABLE {};\n".format(table_name))
slt_file.write("\n")


if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate mem hnsw data for test")
Expand Down

0 comments on commit e0579ea

Please sign in to comment.