diff --git a/internal/core/unittest/test_growing.cpp b/internal/core/unittest/test_growing.cpp index 8ada12e9da..148a682626 100644 --- a/internal/core/unittest/test_growing.cpp +++ b/internal/core/unittest/test_growing.cpp @@ -501,7 +501,7 @@ TEST_P(GrowingTest, FillVectorArrayData) { TEST(GrowingTest, LoadVectorArrayData) { auto schema = std::make_shared(); - auto metric_type = knowhere::metric::L2; + auto metric_type = knowhere::metric::MAX_SIM; auto int64_field = schema->AddDebugField("int64", DataType::INT64); auto array_float_vector = schema->AddDebugVectorArrayField( "array_vec", DataType::VECTOR_FLOAT, 128, metric_type); diff --git a/internal/core/unittest/test_sealed.cpp b/internal/core/unittest/test_sealed.cpp index e81f74e4ff..d2dac32d20 100644 --- a/internal/core/unittest/test_sealed.cpp +++ b/internal/core/unittest/test_sealed.cpp @@ -2277,7 +2277,7 @@ TEST(Sealed, SearchSortedPk) { TEST(Sealed, QueryVectorArrayAllFields) { auto schema = std::make_shared(); - auto metric_type = knowhere::metric::L2; + auto metric_type = knowhere::metric::MAX_SIM; auto int64_field = schema->AddDebugField("int64", DataType::INT64); auto array_vec = schema->AddDebugVectorArrayField( "array_vec", DataType::VECTOR_FLOAT, 128, metric_type); diff --git a/internal/proxy/util.go b/internal/proxy/util.go index 43db708f47..4053a6570a 100644 --- a/internal/proxy/util.go +++ b/internal/proxy/util.go @@ -592,6 +592,10 @@ func ValidateFieldsInStruct(field *schemapb.FieldSchema, schema *schemapb.Collec return fmt.Errorf("Nested array is not supported %s", field.Name) } + if field.ElementType == schemapb.DataType_JSON { + return fmt.Errorf("JSON is not supported for fields in struct, fieldName = %s", field.Name) + } + if field.DataType == schemapb.DataType_Array { if typeutil.IsVectorType(field.GetElementType()) { return fmt.Errorf("Inconsistent schema: element type of array field %s is a vector type", field.Name) diff --git a/internal/proxy/util_test.go b/internal/proxy/util_test.go index 4df7e9b7c4..3bb08a14fa 100644 --- a/internal/proxy/util_test.go +++ b/internal/proxy/util_test.go @@ -3901,6 +3901,17 @@ func TestValidateFieldsInStruct(t *testing.T) { assert.Contains(t, err.Error(), "Fields in StructArrayField can only be array or array of struct") }) + t.Run("JSON not supported in struct", func(t *testing.T) { + field := &schemapb.FieldSchema{ + Name: "json_field", + DataType: schemapb.DataType_Array, + ElementType: schemapb.DataType_JSON, + } + err := ValidateFieldsInStruct(field, schema) + assert.Error(t, err) + assert.Contains(t, err.Error(), "JSON is not supported for fields in struct") + }) + t.Run("nested array not supported", func(t *testing.T) { testCases := []struct { elementType schemapb.DataType