mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-28 22:45:26 +08:00
enhance: set dynamic field as nullable with default empty JSON (#46419)
Set the auto-appended dynamic field to be nullable with a default value
of empty JSON object `{}`. This allows collections with dynamic schema
to handle rows that don't have any dynamic fields more gracefully,
avoiding potential null reference issues when the dynamic field is not
explicitly set during insert.
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
1414065860
commit
bf838eea5d
@ -269,6 +269,12 @@ func (t *createCollectionTask) appendDynamicField(ctx context.Context, schema *s
|
||||
Description: "dynamic schema",
|
||||
DataType: schemapb.DataType_JSON,
|
||||
IsDynamic: true,
|
||||
Nullable: true,
|
||||
DefaultValue: &schemapb.ValueField{
|
||||
Data: &schemapb.ValueField_BytesData{
|
||||
BytesData: []byte("{}"),
|
||||
},
|
||||
},
|
||||
})
|
||||
log.Ctx(ctx).Info("append dynamic field", zap.String("collection", schema.Name))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user