Repository: qdrant/qdrant
File: lib/api/src/conversions/vectors.rs (Rust)

Code before:
                        let multi = MultiDenseVectorInternal::try_from_flatten(data, dim)?;
                        VectorStructInternal::MultiDense(multi)
                    } else {
                        VectorStructInternal::Single(data)
                    }
                }
                grpc::vectors_output::VectorsOptions::Vectors(vectors) => {
                    let grpc::NamedVectorsOutput { vectors } = vectors;
                    let named_vectors: Result<_, _> = vectors
                        .into_iter()
                        .map(|(k, v)| VectorInternal::try_from(v).map(|res| (k, res)))
                        .collect();

                    VectorStructInternal::Named(named_vectors?)
                }
            }),
            None => Err(OperationError::ValidationError {
                description: "No Vector Provided".to_string(),
            }),
        }
    }
}

impl From<VectorInternal> for grpc::Vector {
    fn from(vector: VectorInternal) -> Self {
        // ToDo(v1.18): before deprecating `data`, `indices`, and `vectors_count`, ensure
        //             that `vector` field is generated here.
        match vector {
            VectorInternal::Dense(vector) => Self {
                data: vector,
                indices: None,
                vectors_count: None,
                vector: None,
            },
            VectorInternal::Sparse(vector) => {
                let SparseVector { values, indices } = vector;
                Self {
                    data: values,
                    indices: Some(grpc::SparseIndices { data: indices }),
                    vectors_count: None,
                    vector: None,
                }
            }
            VectorInternal::MultiDense(vector) => {
                let vector_count = vector.multi_vectors().count() as u32;
                let MultiDenseVectorInternal {
                    flattened_vectors,
                    dim: _,
                } = vector;
                Self {
                    data: flattened_vectors,

Review comment (suggestion):
```suggestion
        // ToDo(v1.17): before deprecating `data`, `indices`, and `vectors_count`, ensure
```

Code after:
                        let multi = MultiDenseVectorInternal::try_from_flatten(data, dim)?;
                        VectorStructInternal::MultiDense(multi)
                    } else {
                        VectorStructInternal::Single(data)
                    }
                }
                grpc::vectors_output::VectorsOptions::Vectors(vectors) => {
                    let grpc::NamedVectorsOutput { vectors } = vectors;
                    let named_vectors: Result<_, _> = vectors
                        .into_iter()
                        .map(|(k, v)| VectorInternal::try_from(v).map(|res| (k, res)))
                        .collect();

                    VectorStructInternal::Named(named_vectors?)
                }
            }),
            None => Err(OperationError::ValidationError {
                description: "No Vector Provided".to_string(),
            }),
        }
    }
}

impl From<VectorInternal> for grpc::Vector {
    fn from(vector: VectorInternal) -> Self {
        // ToDo(v1.17): before deprecating `data`, `indices`, and `vectors_count`, ensure
        //             that `vector` field is generated here.
        match vector {
            VectorInternal::Dense(vector) => Self {
                data: vector,
                indices: None,
                vectors_count: None,
                vector: None,
            },
            VectorInternal::Sparse(vector) => {
                let SparseVector { values, indices } = vector;
                Self {
                    data: values,
                    indices: Some(grpc::SparseIndices { data: indices }),
                    vectors_count: None,
                    vector: None,
                }
            }
            VectorInternal::MultiDense(vector) => {
                let vector_count = vector.multi_vectors().count() as u32;
                let MultiDenseVectorInternal {
                    flattened_vectors,
                    dim: _,
                } = vector;
                Self {
                    data: flattened_vectors,