mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-29 18:38:44 +08:00
fix: to just check null in group by field only (#37191)
#37187 Signed-off-by: lixinguo <xinguo.li@zilliz.com> Co-authored-by: lixinguo <xinguo.li@zilliz.com>
This commit is contained in:
parent
889434691c
commit
86b9c3ef4a
@ -347,11 +347,11 @@ func parseGroupByInfo(searchParamsPair []*commonpb.KeyValuePair, schema *schemap
|
||||
if groupByFieldName != "" {
|
||||
fields := schema.GetFields()
|
||||
for _, field := range fields {
|
||||
if field.GetNullable() {
|
||||
ret.err = merr.WrapErrParameterInvalidMsg(fmt.Sprintf("groupBy field(%s) not support nullable == true", groupByFieldName))
|
||||
return ret
|
||||
}
|
||||
if field.Name == groupByFieldName {
|
||||
if field.GetNullable() {
|
||||
ret.err = merr.WrapErrParameterInvalidMsg(fmt.Sprintf("groupBy field(%s) not support nullable == true", groupByFieldName))
|
||||
return ret
|
||||
}
|
||||
groupByFieldId = field.FieldID
|
||||
break
|
||||
}
|
||||
|
@ -2520,6 +2520,28 @@ func TestTaskSearch_parseSearchInfo(t *testing.T) {
|
||||
searchInfo := parseSearchInfo(normalParam, schema, nil)
|
||||
assert.Nil(t, searchInfo.planInfo)
|
||||
assert.ErrorIs(t, searchInfo.parseError, merr.ErrParameterInvalid)
|
||||
|
||||
normalParam = getValidSearchParams()
|
||||
normalParam = append(normalParam, &commonpb.KeyValuePair{
|
||||
Key: GroupByFieldKey,
|
||||
Value: "string_field",
|
||||
})
|
||||
fields = make([]*schemapb.FieldSchema, 0)
|
||||
fields = append(fields, &schemapb.FieldSchema{
|
||||
FieldID: int64(101),
|
||||
Name: "string_field",
|
||||
})
|
||||
fields = append(fields, &schemapb.FieldSchema{
|
||||
FieldID: int64(102),
|
||||
Name: "null_field",
|
||||
Nullable: true,
|
||||
})
|
||||
schema = &schemapb.CollectionSchema{
|
||||
Fields: fields,
|
||||
}
|
||||
searchInfo = parseSearchInfo(normalParam, schema, nil)
|
||||
assert.NotNil(t, searchInfo.planInfo)
|
||||
assert.NoError(t, searchInfo.parseError)
|
||||
})
|
||||
t.Run("check iterator and topK", func(t *testing.T) {
|
||||
normalParam := getValidSearchParams()
|
||||
|
Loading…
Reference in New Issue
Block a user