qdrant-client icon indicating copy to clipboard operation
qdrant-client copied to clipboard

Local mode cannot delete a sparse vector name alongside an unnamed dense vector

Open Marcuswang0824 opened this issue 2 months ago • 1 comments

delete_vector_name("test", "text") fails in local mode when a collection has an unnamed dense vector and a named sparse vector. The same request succeeds against Qdrant 1.19.1.

Reproduced on client dev at ede40ff3b2956414be5835d810321bd003fb100f and rechecked after rebasing onto 5f5f55726256b77b6b0f04b9d9ae5e48d9336c17. Environment: Python 3.12.14, macOS arm64.

Reproduction

from qdrant_client import QdrantClient, models

client = QdrantClient(":memory:")
# With QdrantClient(url="http://localhost:6333"), this succeeds.
client.create_collection(
    "test",
    vectors_config=models.VectorParams(size=2, distance=models.Distance.DOT),
    sparse_vectors_config={"text": models.SparseVectorParams()},
)
client.upsert(
    "test",
    [
        models.PointStruct(
            id=1,
            vector={
                "": [1.0, 0.0],
                "text": models.SparseVector(indices=[1], values=[1.0]),
            },
        )
    ],
    wait=True,
)
client.delete_vector_name("test", "text")

Actual local result:

ValueError: Cannot delete the unnamed vector when it is the only dense vector in the collection

Expected: remove the text sparse-vector configuration and data while retaining the unnamed dense vector. Qdrant 1.19.1 completes the operation, leaves an empty sparse-vector configuration, and returns [1.0, 0.0] when retrieving this point with vectors.

Cause and proposed fix

LocalCollection.delete_vector_name rejects any deletion when self.config.vectors is a VectorParams, even when the requested name belongs to a sparse vector. Restrict that guard to vector_name == DEFAULT_VECTOR_NAME.

A patch is prepared with regression coverage for in-memory mode, persistence across reopening, and continued rejection of deleting the unnamed dense vector. The new reproduction tests failed before the change and pass afterward; the local test set passes, as does the named-vector congruence test against Qdrant 1.19.1.

AI assistance: Codex helped investigate, implement, and draft this report. The reproduction and tests described above were executed locally.

Marcuswang0824 avatar Sep 29 '26 04:09 Marcuswang0824

thanks for pointing it out and fixing it @Marcuswang0824 !

joein avatar Sep 30 '26 10:09 joein