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

sort infer_fields and temp_fields #1430

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pymilvus/orm/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ def check_insert_or_upsert_data_schema(schema: CollectionSchema, data: Union[Lis
i_name = [f.name for f in infer_fields]
t_name = [f.name for f in tmp_fields]
raise DataNotMatchException(message=f"The fields don't match with schema fields, expected: {t_name}, got {i_name}")


# We need to sort the field object to insert data without maintaing order of fields.
infer_fields.sort(key=lambda x: x.name)
tmp_fields.sort(key=lambda x: x.name)

for x, y in zip(infer_fields, tmp_fields):
if x.dtype != y.dtype:
raise DataNotMatchException(message=f"The data type of field {y.name} doesn't match, expected: {y.dtype.name}, got {x.dtype.name}")
Expand Down