mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 03:48:37 +08:00
fix: [GoSDK] Avoid creating schema for non-fast CreateCollection (#34448)
See also #31293 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
6b4d977a10
commit
a1c65dec89
@ -85,7 +85,7 @@ func (opt *createCollectionOption) WithVarcharPK(varcharPK bool, maxLen int) *cr
|
|||||||
|
|
||||||
func (opt *createCollectionOption) Request() *milvuspb.CreateCollectionRequest {
|
func (opt *createCollectionOption) Request() *milvuspb.CreateCollectionRequest {
|
||||||
// fast create collection
|
// fast create collection
|
||||||
if opt.isFast || opt.schema == nil {
|
if opt.isFast {
|
||||||
var pkField *entity.Field
|
var pkField *entity.Field
|
||||||
if opt.varcharPK {
|
if opt.varcharPK {
|
||||||
pkField = entity.NewField().WithDataType(entity.FieldTypeVarChar).WithMaxLength(int64(opt.varcharPKMaxLength))
|
pkField = entity.NewField().WithDataType(entity.FieldTypeVarChar).WithMaxLength(int64(opt.varcharPKMaxLength))
|
||||||
@ -101,8 +101,11 @@ func (opt *createCollectionOption) Request() *milvuspb.CreateCollectionRequest {
|
|||||||
WithField(entity.NewField().WithName(opt.vectorFieldName).WithDataType(entity.FieldTypeFloatVector).WithDim(opt.dim))
|
WithField(entity.NewField().WithName(opt.vectorFieldName).WithDataType(entity.FieldTypeFloatVector).WithDim(opt.dim))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var schemaBytes []byte
|
||||||
|
if opt.schema != nil {
|
||||||
schemaProto := opt.schema.ProtoMessage()
|
schemaProto := opt.schema.ProtoMessage()
|
||||||
schemaBytes, _ := proto.Marshal(schemaProto)
|
schemaBytes, _ = proto.Marshal(schemaProto)
|
||||||
|
}
|
||||||
|
|
||||||
return &milvuspb.CreateCollectionRequest{
|
return &milvuspb.CreateCollectionRequest{
|
||||||
DbName: "", // reserved fields, not used for now
|
DbName: "", // reserved fields, not used for now
|
||||||
|
Loading…
Reference in New Issue
Block a user