forked from zilliztech/VectorDBBench
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
646 lines (419 loc) · 16.6 KB
/
__init__.py
File metadata and controls
646 lines (419 loc) · 16.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
from enum import Enum
from .api import (
DBCaseConfig,
DBConfig,
EmptyDBCaseConfig,
IndexType,
MetricType,
VectorDB,
)
class DB(Enum):
"""Database types
Examples:
>>> DB.Milvus
<DB.Milvus: 'Milvus'>
>>> DB.Milvus.value
"Milvus"
>>> DB.Milvus.name
"Milvus"
"""
Milvus = "Milvus"
ZillizCloud = "ZillizCloud"
Pinecone = "Pinecone"
ElasticCloud = "ElasticCloud"
QdrantCloud = "QdrantCloud"
QdrantLocal = "QdrantLocal"
WeaviateCloud = "WeaviateCloud"
PgVector = "PgVector"
PgVectoRS = "PgVectoRS"
PgVectorScale = "PgVectorScale"
PgDiskANN = "PgDiskANN"
AlloyDB = "AlloyDB"
Redis = "Redis"
MemoryDB = "MemoryDB"
Chroma = "Chroma"
AWSOpenSearch = "OpenSearch"
OSSOpenSearch = "OSSOpenSearch"
AliyunElasticsearch = "AliyunElasticsearch"
MariaDB = "MariaDB"
Test = "test"
AliyunOpenSearch = "AliyunOpenSearch"
MongoDB = "MongoDB"
TiDB = "TiDB"
CockroachDB = "CockroachDB"
Clickhouse = "Clickhouse"
Vespa = "Vespa"
LanceDB = "LanceDB"
OceanBase = "OceanBase"
S3Vectors = "S3Vectors"
Hologres = "Alibaba Cloud Hologres"
TencentElasticsearch = "TencentElasticsearch"
AliSQL = "AlibabaCloudRDSMySQL"
Doris = "Doris"
TurboPuffer = "TurboPuffer"
Zvec = "Zvec"
Endee = "Endee"
Lindorm = "Lindorm"
VectorChord = "VectorChord"
PolarDB = "PolarDB"
@property
def init_cls(self) -> type[VectorDB]: # noqa: PLR0911, PLR0912, C901, PLR0915
"""Import while in use"""
if self == DB.Milvus:
from .milvus.milvus import Milvus
return Milvus
if self == DB.ZillizCloud:
from .zilliz_cloud.zilliz_cloud import ZillizCloud
return ZillizCloud
if self == DB.Pinecone:
from .pinecone.pinecone import Pinecone
return Pinecone
if self == DB.ElasticCloud:
from .elastic_cloud.elastic_cloud import ElasticCloud
return ElasticCloud
if self == DB.QdrantCloud:
from .qdrant_cloud.qdrant_cloud import QdrantCloud
return QdrantCloud
if self == DB.QdrantLocal:
from .qdrant_local.qdrant_local import QdrantLocal
return QdrantLocal
if self == DB.WeaviateCloud:
from .weaviate_cloud.weaviate_cloud import WeaviateCloud
return WeaviateCloud
if self == DB.PgVector:
from .pgvector.pgvector import PgVector
return PgVector
if self == DB.PgVectoRS:
from .pgvecto_rs.pgvecto_rs import PgVectoRS
return PgVectoRS
if self == DB.PgVectorScale:
from .pgvectorscale.pgvectorscale import PgVectorScale
return PgVectorScale
if self == DB.PgDiskANN:
from .pgdiskann.pgdiskann import PgDiskANN
return PgDiskANN
if self == DB.Redis:
from .redis.redis import Redis
return Redis
if self == DB.MemoryDB:
from .memorydb.memorydb import MemoryDB
return MemoryDB
if self == DB.Chroma:
from .chroma.chroma import ChromaClient
return ChromaClient
if self == DB.AWSOpenSearch:
from .aws_opensearch.aws_opensearch import AWSOpenSearch
return AWSOpenSearch
if self == DB.OSSOpenSearch:
from .oss_opensearch.oss_opensearch import OSSOpenSearch
return OSSOpenSearch
if self == DB.Clickhouse:
from .clickhouse.clickhouse import Clickhouse
return Clickhouse
if self == DB.AlloyDB:
from .alloydb.alloydb import AlloyDB
return AlloyDB
if self == DB.AliyunElasticsearch:
from .aliyun_elasticsearch.aliyun_elasticsearch import AliyunElasticsearch
return AliyunElasticsearch
if self == DB.AliyunOpenSearch:
from .aliyun_opensearch.aliyun_opensearch import AliyunOpenSearch
return AliyunOpenSearch
if self == DB.MongoDB:
from .mongodb.mongodb import MongoDB
return MongoDB
if self == DB.OceanBase:
from .oceanbase.oceanbase import OceanBase
return OceanBase
if self == DB.MariaDB:
from .mariadb.mariadb import MariaDB
return MariaDB
if self == DB.TiDB:
from .tidb.tidb import TiDB
return TiDB
if self == DB.CockroachDB:
from .cockroachdb.cockroachdb import CockroachDB
return CockroachDB
if self == DB.Doris:
from .doris.doris import Doris
return Doris
if self == DB.TurboPuffer:
from .turbopuffer.turbopuffer import TurboPuffer
return TurboPuffer
if self == DB.Test:
from .test.test import Test
return Test
if self == DB.Vespa:
from .vespa.vespa import Vespa
return Vespa
if self == DB.LanceDB:
from .lancedb.lancedb import LanceDB
return LanceDB
if self == DB.S3Vectors:
from .s3_vectors.s3_vectors import S3Vectors
return S3Vectors
if self == DB.Hologres:
from .hologres.hologres import Hologres
return Hologres
if self == DB.TencentElasticsearch:
from .tencent_elasticsearch.tencent_elasticsearch import TencentElasticsearch
return TencentElasticsearch
if self == DB.AliSQL:
from .alisql.alisql import AliSQL
return AliSQL
if self == DB.Endee:
from .endee.endee import Endee
return Endee
if self == DB.Zvec:
from .zvec.zvec import Zvec
return Zvec
if self == DB.Lindorm:
from .lindorm.lindorm_search import LindormVector
return LindormVector
if self == DB.VectorChord:
from .vectorchord.vectorchord import VectorChord
return VectorChord
if self == DB.PolarDB:
from .polardb.polardb import PolarDB
return PolarDB
msg = f"Unknown DB: {self.name}"
raise ValueError(msg)
@property
def config_cls(self) -> type[DBConfig]: # noqa: PLR0911, PLR0912, C901, PLR0915
"""Import while in use"""
if self == DB.Milvus:
from .milvus.config import MilvusConfig
return MilvusConfig
if self == DB.ZillizCloud:
from .zilliz_cloud.config import ZillizCloudConfig
return ZillizCloudConfig
if self == DB.Pinecone:
from .pinecone.config import PineconeConfig
return PineconeConfig
if self == DB.ElasticCloud:
from .elastic_cloud.config import ElasticCloudConfig
return ElasticCloudConfig
if self == DB.QdrantCloud:
from .qdrant_cloud.config import QdrantConfig
return QdrantConfig
if self == DB.QdrantLocal:
from .qdrant_local.config import QdrantLocalConfig
return QdrantLocalConfig
if self == DB.WeaviateCloud:
from .weaviate_cloud.config import WeaviateConfig
return WeaviateConfig
if self == DB.PgVector:
from .pgvector.config import PgVectorConfig
return PgVectorConfig
if self == DB.PgVectoRS:
from .pgvecto_rs.config import PgVectoRSConfig
return PgVectoRSConfig
if self == DB.PgVectorScale:
from .pgvectorscale.config import PgVectorScaleConfig
return PgVectorScaleConfig
if self == DB.PgDiskANN:
from .pgdiskann.config import PgDiskANNConfig
return PgDiskANNConfig
if self == DB.Redis:
from .redis.config import RedisConfig
return RedisConfig
if self == DB.MemoryDB:
from .memorydb.config import MemoryDBConfig
return MemoryDBConfig
if self == DB.Chroma:
from .chroma.config import ChromaConfig
return ChromaConfig
if self == DB.AWSOpenSearch:
from .aws_opensearch.config import AWSOpenSearchConfig
return AWSOpenSearchConfig
if self == DB.OSSOpenSearch:
from .oss_opensearch.config import OSSOpenSearchConfig
return OSSOpenSearchConfig
if self == DB.Clickhouse:
from .clickhouse.config import ClickhouseConfig
return ClickhouseConfig
if self == DB.AlloyDB:
from .alloydb.config import AlloyDBConfig
return AlloyDBConfig
if self == DB.AliyunElasticsearch:
from .aliyun_elasticsearch.config import AliyunElasticsearchConfig
return AliyunElasticsearchConfig
if self == DB.AliyunOpenSearch:
from .aliyun_opensearch.config import AliyunOpenSearchConfig
return AliyunOpenSearchConfig
if self == DB.MongoDB:
from .mongodb.config import MongoDBConfig
return MongoDBConfig
if self == DB.OceanBase:
from .oceanbase.config import OceanBaseConfig
return OceanBaseConfig
if self == DB.MariaDB:
from .mariadb.config import MariaDBConfig
return MariaDBConfig
if self == DB.TiDB:
from .tidb.config import TiDBConfig
return TiDBConfig
if self == DB.CockroachDB:
from .cockroachdb.config import CockroachDBConfig
return CockroachDBConfig
if self == DB.Doris:
from .doris.config import DorisConfig
return DorisConfig
if self == DB.TurboPuffer:
from .turbopuffer.config import TurboPufferConfig
return TurboPufferConfig
if self == DB.Test:
from .test.config import TestConfig
return TestConfig
if self == DB.Vespa:
from .vespa.config import VespaConfig
return VespaConfig
if self == DB.LanceDB:
from .lancedb.config import LanceDBConfig
return LanceDBConfig
if self == DB.S3Vectors:
from .s3_vectors.config import S3VectorsConfig
return S3VectorsConfig
if self == DB.Hologres:
from .hologres.config import HologresConfig
return HologresConfig
if self == DB.TencentElasticsearch:
from .tencent_elasticsearch.config import TencentElasticsearchConfig
return TencentElasticsearchConfig
if self == DB.AliSQL:
from .alisql.config import AliSQLConfig
return AliSQLConfig
if self == DB.Endee:
from .endee.config import EndeeConfig
return EndeeConfig
if self == DB.Zvec:
from .zvec.config import ZvecConfig
return ZvecConfig
if self == DB.Lindorm:
from .lindorm.config import LindormConfig
return LindormConfig
if self == DB.VectorChord:
from .vectorchord.config import VectorChordConfig
return VectorChordConfig
if self == DB.PolarDB:
from .polardb.config import PolarDBConfig
return PolarDBConfig
msg = f"Unknown DB: {self.name}"
raise ValueError(msg)
def case_config_cls( # noqa: C901, PLR0911, PLR0912, PLR0915
self,
index_type: IndexType | None = None,
) -> type[DBCaseConfig]:
if self == DB.Milvus:
from .milvus.config import _milvus_case_config
return _milvus_case_config.get(index_type)
if self == DB.ZillizCloud:
from .zilliz_cloud.config import AutoIndexConfig
return AutoIndexConfig
if self == DB.ElasticCloud:
from .elastic_cloud.config import ElasticCloudIndexConfig
return ElasticCloudIndexConfig
if self == DB.QdrantCloud:
from .qdrant_cloud.config import QdrantIndexConfig
return QdrantIndexConfig
if self == DB.QdrantLocal:
from .qdrant_local.config import QdrantLocalIndexConfig
return QdrantLocalIndexConfig
if self == DB.WeaviateCloud:
from .weaviate_cloud.config import WeaviateIndexConfig
return WeaviateIndexConfig
if self == DB.PgVector:
from .pgvector.config import _pgvector_case_config
return _pgvector_case_config.get(index_type)
if self == DB.PgVectoRS:
from .pgvecto_rs.config import _pgvecto_rs_case_config
return _pgvecto_rs_case_config.get(index_type)
if self == DB.AWSOpenSearch:
from .aws_opensearch.config import AWSOpenSearchIndexConfig
return AWSOpenSearchIndexConfig
if self == DB.OSSOpenSearch:
from .oss_opensearch.config import OSSOpenSearchIndexConfig
return OSSOpenSearchIndexConfig
if self == DB.Clickhouse:
from .clickhouse.config import ClickhouseHNSWConfig
return ClickhouseHNSWConfig
if self == DB.PgVectorScale:
from .pgvectorscale.config import _pgvectorscale_case_config
return _pgvectorscale_case_config.get(index_type)
if self == DB.PgDiskANN:
from .pgdiskann.config import _pgdiskann_case_config
return _pgdiskann_case_config.get(index_type)
if self == DB.AlloyDB:
from .alloydb.config import _alloydb_case_config
return _alloydb_case_config.get(index_type)
if self == DB.AliyunElasticsearch:
from .elastic_cloud.config import ElasticCloudIndexConfig
return ElasticCloudIndexConfig
if self == DB.AliyunOpenSearch:
from .aliyun_opensearch.config import AliyunOpenSearchIndexConfig
return AliyunOpenSearchIndexConfig
if self == DB.MongoDB:
from .mongodb.config import MongoDBIndexConfig
return MongoDBIndexConfig
if self == DB.OceanBase:
from .oceanbase.config import _oceanbase_case_config
return _oceanbase_case_config.get(index_type)
if self == DB.MariaDB:
from .mariadb.config import _mariadb_case_config
return _mariadb_case_config.get(index_type)
if self == DB.TiDB:
from .tidb.config import TiDBIndexConfig
return TiDBIndexConfig
if self == DB.CockroachDB:
from .cockroachdb.config import _cockroachdb_case_config
return _cockroachdb_case_config.get(index_type)
if self == DB.Vespa:
from .vespa.config import VespaHNSWConfig
return VespaHNSWConfig
if self == DB.LanceDB:
from .lancedb.config import _lancedb_case_config
return _lancedb_case_config.get(index_type)
if self == DB.S3Vectors:
from .s3_vectors.config import S3VectorsIndexConfig
return S3VectorsIndexConfig
if self == DB.Hologres:
from .hologres.config import HologresIndexConfig
return HologresIndexConfig
if self == DB.Zvec:
from .zvec.config import ZvecHNSWIndexConfig
return ZvecHNSWIndexConfig
if self == DB.TencentElasticsearch:
from .tencent_elasticsearch.config import TencentElasticsearchIndexConfig
return TencentElasticsearchIndexConfig
if self == DB.AliSQL:
from .alisql.alisql import AliSQLIndexConfig
return AliSQLIndexConfig
if self == DB.PolarDB:
from .polardb.config import _polardb_case_config
return _polardb_case_config.get(index_type)
if self == DB.Doris:
from .doris.config import DorisCaseConfig
return DorisCaseConfig
if self == DB.TurboPuffer:
from .turbopuffer.config import TurboPufferIndexConfig
return TurboPufferIndexConfig
if self == DB.Chroma:
from .chroma.config import ChromaIndexConfig
return ChromaIndexConfig
if self == DB.Lindorm:
from .lindorm.config import _lindorm_vector_case_config
return _lindorm_vector_case_config.get(index_type)
if self == DB.VectorChord:
from .vectorchord.config import _vectorchord_case_config
return _vectorchord_case_config.get(index_type)
# DB.Pinecone, DB.Redis
return EmptyDBCaseConfig
__all__ = [
"DB",
"DBCaseConfig",
"DBConfig",
"EmptyDBCaseConfig",
"IndexType",
"MetricType",
"VectorDB",
]