mirror of https://github.com/milvus-io/milvus.git
Fix valid error message (#16953)
Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>pull/16983/head
parent
ca3ecec5b5
commit
52fc9a558c
|
@ -3165,7 +3165,7 @@ func getPrimaryKeysFromExpr(schema *schemapb.CollectionSchema, expr string) (res
|
|||
// delete request only support expr "id in [a, b]"
|
||||
termExpr, ok := plan.Node.(*planpb.PlanNode_Predicates).Predicates.Expr.(*planpb.Expr_TermExpr)
|
||||
if !ok {
|
||||
return res, 0, fmt.Errorf("invalid plan node type")
|
||||
return res, 0, fmt.Errorf("invalid plan node type, only pk in [1, 2] supported")
|
||||
}
|
||||
|
||||
res = &schemapb.IDs{}
|
||||
|
|
|
@ -1844,6 +1844,42 @@ func TestTask_Int64PrimaryKey(t *testing.T) {
|
|||
assert.NoError(t, task.PreExecute(ctx))
|
||||
assert.NoError(t, task.Execute(ctx))
|
||||
assert.NoError(t, task.PostExecute(ctx))
|
||||
|
||||
task2 := &deleteTask{
|
||||
Condition: NewTaskCondition(ctx),
|
||||
BaseDeleteTask: msgstream.DeleteMsg{
|
||||
BaseMsg: msgstream.BaseMsg{},
|
||||
DeleteRequest: internalpb.DeleteRequest{
|
||||
Base: &commonpb.MsgBase{
|
||||
MsgType: commonpb.MsgType_Delete,
|
||||
MsgID: 0,
|
||||
Timestamp: 0,
|
||||
SourceID: Params.ProxyCfg.GetNodeID(),
|
||||
},
|
||||
CollectionName: collectionName,
|
||||
PartitionName: partitionName,
|
||||
},
|
||||
},
|
||||
deleteExpr: "int64 not in [0, 1]",
|
||||
ctx: ctx,
|
||||
result: &milvuspb.MutationResult{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_Success,
|
||||
Reason: "",
|
||||
},
|
||||
IDs: nil,
|
||||
SuccIndex: nil,
|
||||
ErrIndex: nil,
|
||||
Acknowledged: false,
|
||||
InsertCnt: 0,
|
||||
DeleteCnt: 0,
|
||||
UpsertCnt: 0,
|
||||
Timestamp: 0,
|
||||
},
|
||||
chMgr: chMgr,
|
||||
chTicker: ticker,
|
||||
}
|
||||
assert.Error(t, task2.PreExecute(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -2064,6 +2100,42 @@ func TestTask_VarCharPrimaryKey(t *testing.T) {
|
|||
assert.NoError(t, task.PreExecute(ctx))
|
||||
assert.NoError(t, task.Execute(ctx))
|
||||
assert.NoError(t, task.PostExecute(ctx))
|
||||
|
||||
task2 := &deleteTask{
|
||||
Condition: NewTaskCondition(ctx),
|
||||
BaseDeleteTask: msgstream.DeleteMsg{
|
||||
BaseMsg: msgstream.BaseMsg{},
|
||||
DeleteRequest: internalpb.DeleteRequest{
|
||||
Base: &commonpb.MsgBase{
|
||||
MsgType: commonpb.MsgType_Delete,
|
||||
MsgID: 0,
|
||||
Timestamp: 0,
|
||||
SourceID: Params.ProxyCfg.GetNodeID(),
|
||||
},
|
||||
CollectionName: collectionName,
|
||||
PartitionName: partitionName,
|
||||
},
|
||||
},
|
||||
deleteExpr: "varChar not in [\"milvus\", \"test\"]",
|
||||
ctx: ctx,
|
||||
result: &milvuspb.MutationResult{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_Success,
|
||||
Reason: "",
|
||||
},
|
||||
IDs: nil,
|
||||
SuccIndex: nil,
|
||||
ErrIndex: nil,
|
||||
Acknowledged: false,
|
||||
InsertCnt: 0,
|
||||
DeleteCnt: 0,
|
||||
UpsertCnt: 0,
|
||||
Timestamp: 0,
|
||||
},
|
||||
chMgr: chMgr,
|
||||
chTicker: ticker,
|
||||
}
|
||||
assert.Error(t, task2.PreExecute(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue