Skip to content

fix(api): reject empty dense vectors in gRPC Vector::Dense validation - #10143

Merged
timvisee merged 1 commit into
qdrant:devfrom
GuTS805:fix/grpc-dense-vector-empty-validation
Aug 12, 2026
Merged

fix(api): reject empty dense vectors in gRPC Vector::Dense validation#10143
timvisee merged 1 commit into
qdrant:devfrom
GuTS805:fix/grpc-dense-vector-empty-validation

Conversation

@GuTS805

@GuTS805 GuTS805 commented Aug 8, 2026

Copy link
Copy Markdown

All Submissions:

  • My PR targets the dev branch.
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --workspace --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

What does this PR do?

grpc::vector::Vector::Dense was the only variant of the gRPC Vector oneof that skipped emptiness validation:

impl Validate for grpc::vector::Vector {
    fn validate(&self) -> Result<(), ValidationErrors> {
        match self {
            grpc::vector::Vector::Dense(_dense) => Ok(()),   // no check
            grpc::vector::Vector::Sparse(sparse) => sparse.validate(),
            grpc::vector::Vector::MultiDense(multi) => multi.validate(),
            ...
        }
    }
}

Sparse and MultiDense variants already reject empty vectors via
validate_sparse_vector_impl / validate_multi_vector_by_length, but
Dense always returned Ok(()). Reuse the existing
validate_non_empty_dense helper from the REST validation module for
consistency.
@qdrant qdrant deleted a comment from coderabbitai Bot Aug 12, 2026
@timvisee
timvisee merged commit ad58f4b into qdrant:dev Aug 12, 2026
17 checks passed
@GuTS805
GuTS805 deleted the fix/grpc-dense-vector-empty-validation branch August 12, 2026 11:50
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