Browse Source

remove auto-id check for upsert for V2 (#1213)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
groot 5 months ago
parent
commit
11d828bb06
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/main/java/io/milvus/v2/utils/DataUtils.java

+ 2 - 1
src/main/java/io/milvus/v2/utils/DataUtils.java

@@ -176,7 +176,8 @@ public class DataUtils {
                         rowFieldData = JsonNull.INSTANCE;
                         rowFieldData = JsonNull.INSTANCE;
                     }
                     }
 
 
-                    if (field.getAutoID() == Boolean.TRUE) {
+                    // from v2.4.10, milvus allows upsert for auto-id pk, no need to check for upsert action
+                    if (field.getAutoID() == Boolean.TRUE && insertBuilder != null) {
                         String msg = String.format("The primary key: %s is auto generated, no need to input.", fieldName);
                         String msg = String.format("The primary key: %s is auto generated, no need to input.", fieldName);
                         throw new MilvusClientException(ErrorCode.INVALID_PARAMS, msg);
                         throw new MilvusClientException(ErrorCode.INVALID_PARAMS, msg);
                     }
                     }