diff --git a/internal/storage/arrow_util.go b/internal/storage/arrow_util.go index 3f0c30184c..60758a3383 100644 --- a/internal/storage/arrow_util.go +++ b/internal/storage/arrow_util.go @@ -339,6 +339,11 @@ func GenerateEmptyArrayFromSchema(schema *schemapb.FieldSchema, numRows int) (ar bd.AppendValues( lo.RepeatBy(numRows, func(_ int) string { return schema.GetDefaultValue().GetStringData() }), nil) + case schemapb.DataType_JSON: + bd := builder.(*array.BinaryBuilder) + bd.AppendValues( + lo.RepeatBy(numRows, func(_ int) []byte { return schema.GetDefaultValue().GetBytesData() }), + nil) default: return nil, merr.WrapErrServiceInternal(fmt.Sprintf("Unexpected default value type: %s", schema.GetDataType().String())) } diff --git a/internal/storage/arrow_util_test.go b/internal/storage/arrow_util_test.go index c17f31dbf0..cfa73a97cb 100644 --- a/internal/storage/arrow_util_test.go +++ b/internal/storage/arrow_util_test.go @@ -190,6 +190,19 @@ func TestGenerateEmptyArray(t *testing.T) { }, expectErr: true, }, + { + tag: "internal_default_json", + field: &schemapb.FieldSchema{ + DataType: schemapb.DataType_JSON, + Nullable: true, + DefaultValue: &schemapb.ValueField{ + Data: &schemapb.ValueField_BytesData{ + BytesData: []byte(`{}`), + }, + }, + }, + expectValue: []byte(`{}`), + }, } for _, tc := range cases {