fix(predicate): add some other values

pull/15511/head
Kelvin Wang 2019-10-18 18:29:14 -04:00
parent 5bc1d755a9
commit c17a3b97ef
2 changed files with 22 additions and 1 deletions

View File

@ -176,12 +176,17 @@ func (p *parser) parseTagRuleNode() (TagRuleNode, error) {
scanRegularTagValue:
tok, pos, lit = p.scanIgnoreWhitespace()
switch tok {
case influxql.SUB:
n.Value = "-"
goto scanRegularTagValue
case influxql.IDENT:
fallthrough
case influxql.DURATIONVAL:
fallthrough
case influxql.NUMBER:
fallthrough
case influxql.INTEGER:
n.Value = lit
n.Value += lit
return *n, nil
case influxql.TRUE:
n.Value = "true"

View File

@ -85,6 +85,22 @@ func TestParseTagRule(t *testing.T) {
str: ` abc = "opq"`,
node: TagRuleNode{Tag: influxdb.Tag{Key: "abc", Value: "opq"}},
},
{
str: `abc=0x1231`,
node: TagRuleNode{Tag: influxdb.Tag{Key: "abc", Value: "0x1231"}},
},
{
str: `abc=2d`,
node: TagRuleNode{Tag: influxdb.Tag{Key: "abc", Value: "2d"}},
},
{
str: `abc=-5i`,
node: TagRuleNode{Tag: influxdb.Tag{Key: "abc", Value: "-5i"}},
},
{
str: `abc= -1221`,
node: TagRuleNode{Tag: influxdb.Tag{Key: "abc", Value: "-1221"}},
},
{
str: ` abc != "opq"`,
err: &influxdb.Error{