From 4a74c96e6ccd8d0afa5ab9b93a01f9a0076d7240 Mon Sep 17 00:00:00 2001 From: Buqian Zheng Date: Mon, 4 Nov 2024 15:34:24 +0800 Subject: [PATCH] fix: bulkwriter to skip function output fields (#2319) https://github.com/milvus-io/milvus/issues/37196 Signed-off-by: Buqian Zheng Signed-off-by: NamCaoHai --- pymilvus/bulk_writer/buffer.py | 2 ++ pymilvus/bulk_writer/bulk_writer.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/pymilvus/bulk_writer/buffer.py b/pymilvus/bulk_writer/buffer.py index 54ead0ffa..2935e575b 100644 --- a/pymilvus/bulk_writer/buffer.py +++ b/pymilvus/bulk_writer/buffer.py @@ -52,6 +52,8 @@ def __init__( for field in schema.fields: if field.is_primary and field.auto_id: continue + if field.is_function_output: + continue self._buffer[field.name] = [] self._fields[field.name] = field diff --git a/pymilvus/bulk_writer/bulk_writer.py b/pymilvus/bulk_writer/bulk_writer.py index 0a4451d8c..e6f1f71f4 100644 --- a/pymilvus/bulk_writer/bulk_writer.py +++ b/pymilvus/bulk_writer/bulk_writer.py @@ -194,6 +194,11 @@ def _verify_row(self, row: dict): ) else: continue + if field.is_function_output: + if field.name in row: + self._throw(f"Field '{field.name}' is function output, no need to provide") + else: + continue if field.name not in row: self._throw(f"The field '{field.name}' is missed in the row")