Bool expr not support numerica (#12184)

Signed-off-by: fishpenguin <kun.yu@zilliz.com>
pull/12184/merge
yukun 2021-11-23 10:57:16 +08:00 committed by GitHub
parent 01be91116e
commit adf9530ed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 15 deletions

View File

@ -567,17 +567,6 @@ func (pc *parserContext) handleLeafValue(nodeRaw *ant_ast.Node, dataType schemap
Int64Val: int64(node.Value), Int64Val: int64(node.Value),
}, },
} }
} else if dataType == schemapb.DataType_Bool {
gv = &planpb.GenericValue{
Val: &planpb.GenericValue_BoolVal{},
}
if node.Value == 1 {
gv.Val.(*planpb.GenericValue_BoolVal).BoolVal = true
} else if node.Value == 0 {
gv.Val.(*planpb.GenericValue_BoolVal).BoolVal = false
} else {
return nil, fmt.Errorf("bool field should only match 0 or 1")
}
} else { } else {
return nil, fmt.Errorf("type mismatch") return nil, fmt.Errorf("type mismatch")
} }

View File

@ -250,12 +250,11 @@ func TestExprMultiRange_Str(t *testing.T) {
"BoolN1 == True", "BoolN1 == True",
"True == BoolN1", "True == BoolN1",
"BoolN1 == False", "BoolN1 == False",
"BoolN1 == 1",
"BoolN1 == 0",
} }
invalidExprs := []string{ invalidExprs := []string{
"BoolN1 == 2", "BoolN1 == 1",
"BoolN1 > 2", "BoolN1 == 0",
"BoolN1 > 0",
} }
fields := []*schemapb.FieldSchema{ fields := []*schemapb.FieldSchema{