Skip to content

Commit 90d1dbf

Browse files
committed
Allow to insert pk even when auto-id is true, milvus v2.6.3 supports (milvus-io#1710)
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent ad2a5af commit 90d1dbf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sdk-core/src/main/java/io/milvus/v2/utils/DataUtils.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,12 @@ private void processNormalFieldValues(JsonObject row, CreateCollectionReq.FieldS
273273
}
274274

275275
// from v2.4.10, milvus allows upsert for auto-id pk, no need to check for upsert action
276-
if (field.getAutoID() == Boolean.TRUE && insertBuilder != null) {
277-
String msg = String.format("The primary key: %s is auto generated, no need to input.", fieldName);
278-
throw new MilvusClientException(ErrorCode.INVALID_PARAMS, msg);
279-
}
276+
// from v2.6.3, user can insert pk value even when auto-id is true if the collection
277+
// has "allow_insert_auto_id" property, no need to check for insert/upsert action.
278+
// if (field.getAutoID() == Boolean.TRUE && insertBuilder != null) {
279+
// String msg = String.format("The primary key: %s is auto generated, no need to input.", fieldName);
280+
// throw new MilvusClientException(ErrorCode.INVALID_PARAMS, msg);
281+
// }
280282

281283
// store the value into InsertDataInfo
282284
Object fieldValue = DataUtils.checkFieldValue(field, fieldData);

0 commit comments

Comments
 (0)