From cbc3c62aeedc4a88b1d898916dc14cd89b2321f0 Mon Sep 17 00:00:00 2001 From: Xwg Date: Tue, 26 Dec 2023 20:57:46 +0800 Subject: [PATCH] Fix drop stl --- python/hello_infinity.py | 16 +++++++++++----- test/sql/ddl/drop/test_drop.slt | 6 ++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/python/hello_infinity.py b/python/hello_infinity.py index 6417a64d15..69ba89d820 100644 --- a/python/hello_infinity.py +++ b/python/hello_infinity.py @@ -19,12 +19,18 @@ def main(): infinity_obj = infinity.connect(REMOTE_HOST) db = infinity_obj.get_database("default") - db.drop_table("my_table2", if_exists=True) + db.drop_table("my_table", if_exists=True) table = db.create_table( - "my_table2", {"c1": "integer", "c2": "float"}, None) - for i in range(8): - table.insert( - [{"c1": i, "c2": float(i)}]) + "my_table", {"num": "integer", "body": "varchar", "vec": "vector,5,float"}, None) + table.insert( + [{"num": 1, "body": "undesirable, unnecessary, and harmful", "vec": [1.0] * 5}]) + table.insert( + [{"num": 2, "body": "publisher=US National Office for Harmful Algal Blooms", "vec": [4.0] * 5}]) + table.insert( + [{"num": 3, "body": "in the case of plants, growth and chemical", "vec": [7.0] * 5}]) + + res = table.output(["*"]).knn("vec", [3.0] * 5, "float", "ip", 2).to_pl() + print(res) if __name__ == '__main__': diff --git a/test/sql/ddl/drop/test_drop.slt b/test/sql/ddl/drop/test_drop.slt index 56f58d19f5..5691f3d35e 100644 --- a/test/sql/ddl/drop/test_drop.slt +++ b/test/sql/ddl/drop/test_drop.slt @@ -12,9 +12,10 @@ DROP TABLE IF EXISTS test_drop; statement ok CREATE TABLE test_drop (i INTEGER); -statement ok -INSERT INTO a VALUES (42); +query I +INSERT INTO test_drop VALUES (42); +---- #statement error #SELECT COUNT(*) FROM a; @@ -23,6 +24,7 @@ INSERT INTO a VALUES (42); query I SELECT * FROM test_drop; ---- +42 statement ok DROP TABLE test_drop; \ No newline at end of file