fix: wrong format expr for the delete rest api (#30217)

/kind improvement
issue: #30092

Signed-off-by: SimFG <bang.fu@zilliz.com>
This commit is contained in:
SimFG 2024-01-24 11:27:06 +08:00 committed by GitHub
parent 0907d76253
commit b62748a1a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -102,7 +102,7 @@ func convertRange(field *schemapb.FieldSchema, result gjson.Result) (string, err
if err != nil { if err != nil {
return "", err return "", err
} }
dataArray = append(dataArray, value) dataArray = append(dataArray, fmt.Sprintf(`"%s"`, value))
} }
resultStr = joinArray(dataArray) resultStr = joinArray(dataArray)
} }

View File

@ -340,10 +340,11 @@ func TestPrimaryField(t *testing.T) {
idStr = gjson.Get(jsonStr, "id") idStr = gjson.Get(jsonStr, "id")
rangeStr, err = convertRange(&primaryField, idStr) rangeStr, err = convertRange(&primaryField, idStr)
assert.Equal(t, nil, err) assert.Equal(t, nil, err)
assert.Equal(t, "1,2,3", rangeStr) assert.Equal(t, `"1","2","3"`, rangeStr)
filter, err = checkGetPrimaryKey(coll, idStr) coll2 := generateCollectionSchema(schemapb.DataType_VarChar, false)
filter, err = checkGetPrimaryKey(coll2, idStr)
assert.Equal(t, nil, err) 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) { func TestInsertWithDynamicFields(t *testing.T) {