Skip to content
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

Data validation for Insert() #161

Open
yhmo opened this issue Mar 3, 2022 · 0 comments
Open

Data validation for Insert() #161

yhmo opened this issue Mar 3, 2022 · 0 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@yhmo
Copy link
Collaborator

yhmo commented Mar 3, 2022

The milvus server requires the insert data arranged by collection schema.
For example, a collection has two fields "id" and "vectors"

    milvus::CollectionSchema collection_schema(collection_name);
    collection_schema.AddField({"id", milvus::DataType::INT64, "user id", true, false});
    collection_schema.AddField(milvus::FieldSchema("vectors", milvus::DataType::FLOAT_VECTOR, "face signature")
                                   .WithDimension(dimension));

If we construct the data in this way:

    std::vector<milvus::FieldDataPtr> fields_data{
    std::make_shared<milvus::FloatVecFieldData>("vectors", insert_vectors),
    std::make_shared<milvus::Int64FieldData>("id", insert_ids)};
    milvus::DmlResults dml_results;
    status = client->Insert(collection_name, partition_name, fields_data, dml_results);

The Insert() return Ok, but in face the data is cracked.

There Insert() should validate the insert data by these rules:

  1. make sure the insert data is arranged(the sequence of column) by collection schema.
  2. field types should be equal to collection schema.
  3. vector dimensions should be equal to collection schema.
  4. if a primary key is auto_id, no need to input this field.
@yhmo yhmo added the kind/bug Something isn't working label Mar 3, 2022
@yhmo yhmo self-assigned this Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant