diff --git a/internal/distributed/proxy/httpserver/utils.go b/internal/distributed/proxy/httpserver/utils.go index 2384ff2cee..8a8a330f4e 100644 --- a/internal/distributed/proxy/httpserver/utils.go +++ b/internal/distributed/proxy/httpserver/utils.go @@ -102,7 +102,7 @@ func convertRange(field *schemapb.FieldSchema, result gjson.Result) (string, err if err != nil { return "", err } - dataArray = append(dataArray, value) + dataArray = append(dataArray, fmt.Sprintf(`"%s"`, value)) } resultStr = joinArray(dataArray) } diff --git a/internal/distributed/proxy/httpserver/utils_test.go b/internal/distributed/proxy/httpserver/utils_test.go index 187e269b76..3333db1109 100644 --- a/internal/distributed/proxy/httpserver/utils_test.go +++ b/internal/distributed/proxy/httpserver/utils_test.go @@ -340,10 +340,11 @@ func TestPrimaryField(t *testing.T) { idStr = gjson.Get(jsonStr, "id") rangeStr, err = convertRange(&primaryField, idStr) assert.Equal(t, nil, err) - assert.Equal(t, "1,2,3", rangeStr) - filter, err = checkGetPrimaryKey(coll, idStr) + assert.Equal(t, `"1","2","3"`, rangeStr) + coll2 := generateCollectionSchema(schemapb.DataType_VarChar, false) + filter, err = checkGetPrimaryKey(coll2, idStr) assert.Equal(t, nil, err) - assert.Equal(t, "book_id in [1,2,3]", filter) + assert.Equal(t, `book_id in ["1","2","3"]`, filter) } func TestInsertWithDynamicFields(t *testing.T) {