Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Balwancia
Copy link

@Balwancia Balwancia commented Apr 21, 2025

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

Add Cassandra integration for ann-benchmark - single replica case
batch.clear()
if batch:
self.conn.execute(batch)

Copy link

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")
Copy link

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()

Copy link

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()
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants