-
Notifications
You must be signed in to change notification settings - Fork 801
Add Cassandra integration #588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add Cassandra integration for ann-benchmark - single replica case
batch.clear() | ||
if batch: | ||
self.conn.execute(batch) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We miss a method to parse experiment parameters (query_args
in the config file):
def set_query_arguments(self, params):
self._ef_search = params
"DOT": "DOT_PRODUCT", | ||
} | ||
|
||
hnsw_distance_type = self.DISTANCE_MAPPING.get(self.metric, "EUCLIDEAN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.
is not needed here as DISTANCE_MAPPING
is local variable
def fit(self, X, batch_size=100): | ||
self.vector_dim = X.shape[1] | ||
self._create_table() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to call self._create_index()
here as well.
|
||
insert_query = f"INSERT INTO {self.table_name} (id, embedding) VALUES (?, ?)" | ||
prepared = self.conn.prepare(insert_query) | ||
batch = BatchStatement() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use BatchStatement(batch_type=BatchType.UNLOGGED)
here - this will use unlogged batches which are faster (no need to write them to log which is not needed while using it just for benchmarking).
Add Cassandra integration for ann-benchmark - single replica case
Run this commands to test it:
pip3 install -r requirements.txt
python3 install.py --algorithm cassandra
python3 run.py --dataset glove-25-angular --algorithm cassandra