mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 03:18:29 +08:00
Signed-off-by: yhmo <yihua.mo@zilliz.com> Signed-off-by: yhmo <yihua.mo@zilliz.com> Signed-off-by: yhmo <yihua.mo@zilliz.com>
This commit is contained in:
parent
ec48e2405a
commit
b161aec95e
@ -280,14 +280,11 @@ func (w *PayloadWriter) AddDoubleToPayload(msgs []float64) error {
|
||||
|
||||
func (w *PayloadWriter) AddOneStringToPayload(msg string) error {
|
||||
length := len(msg)
|
||||
if length == 0 {
|
||||
return errors.New("can't add empty string into payload")
|
||||
}
|
||||
|
||||
cmsg := C.CString(msg)
|
||||
clength := C.int(length)
|
||||
defer C.free(unsafe.Pointer(cmsg))
|
||||
|
||||
// the C.AddOneStringToPayload can handle empty string
|
||||
status := C.AddOneStringToPayload(w.payloadWriterPtr, cmsg, clength)
|
||||
return HandleCStatus(&status, "AddOneStringToPayload failed")
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ func TestPayload_CGO_ReaderandWriter(t *testing.T) {
|
||||
assert.NotNil(t, err)
|
||||
|
||||
err = w.AddOneStringToPayload("")
|
||||
assert.NotNil(t, err)
|
||||
assert.Nil(t, err)
|
||||
err = w.FinishPayloadWriter()
|
||||
assert.Nil(t, err)
|
||||
err = w.AddOneStringToPayload("c")
|
||||
|
@ -567,7 +567,7 @@ func TestPayload_ReaderAndWriter(t *testing.T) {
|
||||
assert.NotNil(t, err)
|
||||
|
||||
err = w.AddOneStringToPayload("")
|
||||
assert.NotNil(t, err)
|
||||
assert.Nil(t, err)
|
||||
err = w.FinishPayloadWriter()
|
||||
assert.Nil(t, err)
|
||||
err = w.AddOneStringToPayload("c")
|
||||
|
@ -1202,23 +1202,6 @@ class TestInsertString(TestcaseBase):
|
||||
error = {ct.err_code: 0, ct.err_msg: 'Data type is not support.'}
|
||||
collection_w.insert(data=df, check_task=CheckTasks.err_res, check_items=error)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.skip(reason="https://github.com/milvus-io/milvus/issues/18872, need to fix")
|
||||
def test_insert_string_field_empty(self):
|
||||
"""
|
||||
target: test create collection with string field
|
||||
method: 1.create a collection
|
||||
2.Insert string field with empty data
|
||||
expected: raise an error
|
||||
"""
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
collection_w = self.init_collection_wrap(name=c_name)
|
||||
nb = 1000
|
||||
data = cf.gen_default_list_data(nb)
|
||||
data[2] = [""for _ in range(nb)]
|
||||
collection_w.insert(data)
|
||||
assert collection_w.num_entities == nb
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
def test_insert_string_field_space(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user