13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
import unittest
16
+ from test .markers import qdrant_skip_marker
16
17
from test .util import (
17
18
DummyObjectDetector ,
18
19
create_sample_video ,
@@ -46,7 +47,9 @@ def setUpClass(cls):
46
47
def setUp (self ):
47
48
self .evadb .catalog ().reset ()
48
49
self .mnist_path = f"{ EvaDB_ROOT_DIR } /data/mnist/mnist.mp4"
49
- load_udfs_for_testing (self .evadb ,)
50
+ load_udfs_for_testing (
51
+ self .evadb ,
52
+ )
50
53
self .images = f"{ EvaDB_ROOT_DIR } /data/detoxify/*.jpg"
51
54
52
55
def tearDown (self ):
@@ -57,15 +60,20 @@ def tearDown(self):
57
60
58
61
def test_relation_apis (self ):
59
62
cursor = self .conn .cursor ()
60
- rel = cursor .load (self .mnist_path , table_name = "mnist_video" , format = "video" ,)
63
+ rel = cursor .load (
64
+ self .mnist_path ,
65
+ table_name = "mnist_video" ,
66
+ format = "video" ,
67
+ )
61
68
rel .execute ()
62
69
63
70
rel = cursor .table ("mnist_video" )
64
71
assert_frame_equal (rel .df (), cursor .query ("select * from mnist_video;" ).df ())
65
72
66
73
rel = rel .select ("_row_id, id, data" )
67
74
assert_frame_equal (
68
- rel .df (), cursor .query ("select _row_id, id, data from mnist_video;" ).df (),
75
+ rel .df (),
76
+ cursor .query ("select _row_id, id, data from mnist_video;" ).df (),
69
77
)
70
78
71
79
rel = rel .filter ("id < 10" )
@@ -88,7 +96,11 @@ def test_relation_apis(self):
88
96
where id < 10 AND mnist.label = 1;"""
89
97
assert_frame_equal (rel .df (), cursor .query (query ).df ())
90
98
91
- rel = cursor .load (self .images , table_name = "meme_images" , format = "image" ,)
99
+ rel = cursor .load (
100
+ self .images ,
101
+ table_name = "meme_images" ,
102
+ format = "image" ,
103
+ )
92
104
rel .execute ()
93
105
94
106
rel = cursor .table ("meme_images" ).select ("_row_id, name" )
@@ -107,7 +119,11 @@ def test_relation_apis(self):
107
119
def test_relation_api_chaining (self ):
108
120
cursor = self .conn .cursor ()
109
121
110
- rel = cursor .load (self .mnist_path , table_name = "mnist_video" , format = "video" ,)
122
+ rel = cursor .load (
123
+ self .mnist_path ,
124
+ table_name = "mnist_video" ,
125
+ format = "video" ,
126
+ )
111
127
rel .execute ()
112
128
113
129
rel = (
@@ -126,7 +142,11 @@ def test_relation_api_chaining(self):
126
142
def test_interleaving_calls (self ):
127
143
cursor = self .conn .cursor ()
128
144
129
- rel = cursor .load (self .mnist_path , table_name = "mnist_video" , format = "video" ,)
145
+ rel = cursor .load (
146
+ self .mnist_path ,
147
+ table_name = "mnist_video" ,
148
+ format = "video" ,
149
+ )
130
150
rel .execute ()
131
151
132
152
rel = cursor .table ("mnist_video" )
@@ -142,11 +162,16 @@ def test_interleaving_calls(self):
142
162
cursor .query ("select _row_id, id from mnist_video where id > 10;" ).df (),
143
163
)
144
164
165
+ @qdrant_skip_marker
145
166
def test_create_index (self ):
146
167
cursor = self .conn .cursor ()
147
168
148
169
# load some images
149
- rel = cursor .load (self .images , table_name = "meme_images" , format = "image" ,)
170
+ rel = cursor .load (
171
+ self .images ,
172
+ table_name = "meme_images" ,
173
+ format = "image" ,
174
+ )
150
175
rel .execute ()
151
176
152
177
# todo support register udf
@@ -186,7 +211,11 @@ def test_create_udf_with_relational_api(self):
186
211
187
212
cursor = self .conn .cursor ()
188
213
# load video
189
- rel = cursor .load (video_file_path , table_name = "dummy_video" , format = "video" ,)
214
+ rel = cursor .load (
215
+ video_file_path ,
216
+ table_name = "dummy_video" ,
217
+ format = "video" ,
218
+ )
190
219
rel .execute ()
191
220
192
221
create_dummy_object_detector_udf = cursor .create_udf (
@@ -238,7 +267,11 @@ def test_drop_with_relational_api(self):
238
267
239
268
cursor = self .conn .cursor ()
240
269
# load video
241
- rel = cursor .load (video_file_path , table_name = "dummy_video" , format = "video" ,)
270
+ rel = cursor .load (
271
+ video_file_path ,
272
+ table_name = "dummy_video" ,
273
+ format = "video" ,
274
+ )
242
275
rel .execute ()
243
276
244
277
# Create dummy udf
@@ -294,13 +327,9 @@ def test_drop_with_relational_api(self):
294
327
def test_pdf_similarity_search (self ):
295
328
conn = connect ()
296
329
cursor = conn .cursor ()
297
- pdf_path1 = f"{ EvaDB_ROOT_DIR } /data/documents/state_of_the_union.pdf"
298
- pdf_path2 = f"{ EvaDB_ROOT_DIR } /data/documents/layout-parser-paper.pdf"
299
-
300
- load_pdf = cursor .load (file_regex = pdf_path1 , format = "PDF" , table_name = "PDFs" )
301
- load_pdf .execute ()
330
+ pdf_path = f"{ EvaDB_ROOT_DIR } /data/documents/state_of_the_union.pdf"
302
331
303
- load_pdf = cursor .load (file_regex = pdf_path2 , format = "PDF" , table_name = "PDFs" )
332
+ load_pdf = cursor .load (file_regex = pdf_path , format = "PDF" , table_name = "PDFs" )
304
333
load_pdf .execute ()
305
334
306
335
udf_check = cursor .drop_udf ("SentenceFeatureExtractor" )
@@ -316,7 +345,7 @@ def test_pdf_similarity_search(self):
316
345
"faiss_index" ,
317
346
table_name = "PDFs" ,
318
347
expr = "SentenceFeatureExtractor(data)" ,
319
- using = "QDRANT " ,
348
+ using = "FAISS " ,
320
349
).df ()
321
350
322
351
query = (
@@ -369,7 +398,11 @@ def test_show_relational(self):
369
398
370
399
cursor = self .conn .cursor ()
371
400
# load video
372
- rel = cursor .load (video_file_path , table_name = "dummy_video" , format = "video" ,)
401
+ rel = cursor .load (
402
+ video_file_path ,
403
+ table_name = "dummy_video" ,
404
+ format = "video" ,
405
+ )
373
406
rel .execute ()
374
407
375
408
result = cursor .show ("tables" ).df ()
@@ -381,7 +414,11 @@ def test_explain_relational(self):
381
414
382
415
cursor = self .conn .cursor ()
383
416
# load video
384
- rel = cursor .load (video_file_path , table_name = "dummy_video" , format = "video" ,)
417
+ rel = cursor .load (
418
+ video_file_path ,
419
+ table_name = "dummy_video" ,
420
+ format = "video" ,
421
+ )
385
422
rel .execute ()
386
423
387
424
result = cursor .explain ("SELECT * FROM dummy_video" ).df ()
@@ -396,7 +433,11 @@ def test_rename_relational(self):
396
433
397
434
cursor = self .conn .cursor ()
398
435
# load video
399
- rel = cursor .load (video_file_path , table_name = "dummy_video" , format = "video" ,)
436
+ rel = cursor .load (
437
+ video_file_path ,
438
+ table_name = "dummy_video" ,
439
+ format = "video" ,
440
+ )
400
441
rel .execute ()
401
442
402
443
cursor .rename ("dummy_video" , "dummy_video_renamed" ).df ()
0 commit comments