mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: Fix bug for parse expression that include quotes (#28418)
master pr: #28416 issue: #28365 Fix bug for parsing error when a string enclosed in single quotes in an expression contains multiple double quotes. such as: ``` expr = "tag == '\"blue\"'" ``` Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
5ca7851f4a
commit
968d6fdcde
@ -191,7 +191,7 @@ func (ib *indexBuilder) run() {
|
||||
for _, buildID := range buildIDs {
|
||||
ok := ib.process(buildID)
|
||||
if !ok {
|
||||
log.Ctx(ib.ctx).Info("there is no IndexNode available or etcd is not serviceable, wait a minute...")
|
||||
log.Ctx(ib.ctx).Info("there is no idle indexing node, wait a minute...")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -934,6 +934,7 @@ func Test_EscapeString(t *testing.T) {
|
||||
`str2 like 'abc"def-%'`,
|
||||
`str4 like "abc\367-%"`,
|
||||
`str4 like "中国"`,
|
||||
`tag == '"blue"'`,
|
||||
}
|
||||
for _, expr = range exprs {
|
||||
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
|
||||
|
||||
@ -504,7 +504,7 @@ func convertEscapeSingle(literal string) (string, error) {
|
||||
b.WriteString(literal[start : end-1])
|
||||
b.WriteString(`'`)
|
||||
}
|
||||
start = end
|
||||
start = end + 1
|
||||
}
|
||||
b.WriteString(literal[end+1 : len(literal)-1])
|
||||
b.WriteString(`"`)
|
||||
|
||||
@ -187,6 +187,13 @@ func Test_convertEscapeSingle(t *testing.T) {
|
||||
{`"\\\\'"`, `\\'`},
|
||||
{`"\\\\\'"`, `\\'`},
|
||||
{`'"'`, `"`},
|
||||
{`'""'`, `""`},
|
||||
{`'"""'`, `"""`},
|
||||
{`'"\""'`, `"""`},
|
||||
{`'a"b\"c\\"d'`, `a"b"c\"d`},
|
||||
{`"a\"b\"c\\\"d"`, `a"b"c\"d`},
|
||||
{`'A "test"'`, `A "test"`},
|
||||
{`"A \"test\""`, `A "test"`},
|
||||
{`'\"'`, `"`},
|
||||
{`'\\"'`, `\"`},
|
||||
{`'\\\"'`, `\"`},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user