Skip to content

Commit 4efbe83

Browse files
authored
Fixing Bugs in Benchmarking ClickHouse with vectordbbench (zilliztech#523)
* Update cli.py * Update clickhouse.py * Update clickhouse.py * Update cli.py * Update config.py * remove space
1 parent 2b966c3 commit 4efbe83

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

vectordb_bench/backend/clients/clickhouse/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def Clickhouse(**parameters: Unpack[ClickhouseHNSWTypedDict]):
5151
db=DB.Clickhouse,
5252
db_config=ClickhouseConfig(
5353
db_label=parameters["db_label"],
54+
user=parameters["user"],
5455
password=SecretStr(parameters["password"]) if parameters["password"] else None,
5556
host=parameters["host"],
5657
port=parameters["port"],

vectordb_bench/backend/clients/clickhouse/clickhouse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def _create_index(self):
106106
query = f"""
107107
ALTER TABLE {self.db_config["database"]}.{self.table_name}
108108
ADD INDEX {self._index_name} {self._vector_field}
109-
TYPE vector_similarity('hnsw', '{self.index_param["metric_type"]}',
109+
TYPE vector_similarity('hnsw', '{self.index_param["metric_type"]}',{self.dim},
110110
'{self.index_param["quantization"]}',
111111
{self.index_param["params"]["M"]}, {self.index_param["params"]["efConstruction"]})
112112
GRANULARITY {self.index_param["granularity"]}
@@ -115,7 +115,7 @@ def _create_index(self):
115115
query = f"""
116116
ALTER TABLE {self.db_config["database"]}.{self.table_name}
117117
ADD INDEX {self._index_name} {self._vector_field}
118-
TYPE vector_similarity('hnsw', '{self.index_param["metric_type"]}')
118+
TYPE vector_similarity('hnsw', '{self.index_param["metric_type"]}', {self.dim})
119119
GRANULARITY {self.index_param["granularity"]}
120120
"""
121121
self.conn.command(cmd=query)
@@ -186,7 +186,7 @@ def search_embedding(
186186
"vector_field": self._vector_field,
187187
"schema": self.db_config["database"],
188188
"table": self.table_name,
189-
"gt": filters.get("id"),
189+
"gt": 0 if filters is None else filters.get("id", 0),
190190
"k": k,
191191
"metric_type": self.search_param["metric_type"],
192192
"query": query,

vectordb_bench/backend/clients/clickhouse/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ClickhouseConfigDict(TypedDict):
1616

1717

1818
class ClickhouseConfig(DBConfig):
19-
user_name: str = "clickhouse"
19+
user: str = "clickhouse"
2020
password: SecretStr
2121
host: str = "localhost"
2222
port: int = 8123
@@ -29,7 +29,7 @@ def to_dict(self) -> ClickhouseConfigDict:
2929
"host": self.host,
3030
"port": self.port,
3131
"database": self.db_name,
32-
"user": self.user_name,
32+
"user": self.user,
3333
"password": pwd_str,
3434
"secure": self.secure,
3535
}

0 commit comments

Comments
 (0)