Skip to content

Commit

Permalink
entity_is_sparse_matrix: each row should be dict or list
Browse files Browse the repository at this point in the history
fix _parse_upsert_row_request to use input_fields_info instead of fields_info

Signed-off-by: Buqian Zheng <[email protected]>
  • Loading branch information
zhengbuqian committed Oct 23, 2024
1 parent 4f64af7 commit 3594b23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pymilvus/client/entity_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def is_float_type(v: Any):
for item in entity:
if SciPyHelper.is_scipy_sparse(item):
return item.shape[0] == 1
if not isinstance(item, dict) and not isinstance(item, list):
return False
pairs = item.items() if isinstance(item, dict) else item
# each row must be a list of Tuple[int, float]. we allow empty sparse row
for pair in pairs:
Expand Down
4 changes: 2 additions & 2 deletions pymilvus/client/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def _parse_upsert_row_request(
):
field_data.valid_data.append(v is not None)
entity_helper.pack_field_value_to_field_data(v, field_data, field_info)
for field in fields_info:
for field in input_fields_info:
key = field["name"]
if key in entity:
continue
Expand All @@ -538,7 +538,7 @@ def _parse_upsert_row_request(

request.fields_data.extend(fields_data.values())

for _, field in enumerate(fields_info):
for _, field in enumerate(input_fields_info):
is_dynamic = False
field_name = field["name"]

Expand Down

0 comments on commit 3594b23

Please sign in to comment.