未验证 提交 9a0a41d2 编写于 作者: C cai.zhang 提交者: GitHub

Support access json key without quotation marks (#24062)

Signed-off-by: Ncai.zhang <cai.zhang@zilliz.com>
上级 8bfb4282
......@@ -85,7 +85,7 @@ FloatingConstant:
Identifier: Nondigit (Nondigit | Digit)*;
StringLiteral: EncodingPrefix? '"' SCharSequence? '"';
JSONIdentifier: Identifier('[' (StringLiteral | IntegerConstant) ']')+;
JSONIdentifier: Identifier('[' ('"' SCharSequence '"' | '\'' SCharSequence '\'' | SCharSequence | IntegerConstant) ']')+;
fragment EncodingPrefix: 'u8' | 'u' | 'U' | 'L';
......
......@@ -830,6 +830,33 @@ func Test_JSONExpr(t *testing.T) {
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `A[B][0] > 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `A['B'][0] > 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField[0] > 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
}
func Test_InvalidExprOnJSONField(t *testing.T) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册