vendor: update github.com/VictoriaMetrics/metricsql from v0.4.1 to v0.4.2

The new version of this package properly supports escaped identifiers.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/743
This commit is contained in:
Aliaksandr Valialkin 2020-09-03 14:49:49 +03:00
parent e706e59d49
commit d5b985f086
4 changed files with 18 additions and 22 deletions

2
go.mod
View file

@ -8,7 +8,7 @@ require (
// like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b
github.com/VictoriaMetrics/fasthttp v1.0.5
github.com/VictoriaMetrics/metrics v1.12.3
github.com/VictoriaMetrics/metricsql v0.4.1
github.com/VictoriaMetrics/metricsql v0.4.2
github.com/aws/aws-sdk-go v1.34.14
github.com/cespare/xxhash/v2 v2.1.1
github.com/golang/snappy v0.0.1

4
go.sum
View file

@ -58,8 +58,8 @@ github.com/VictoriaMetrics/metrics v1.12.2 h1:SG8iAmqavDNuh7GIdHPoGHUhDL23KeKfvS
github.com/VictoriaMetrics/metrics v1.12.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE=
github.com/VictoriaMetrics/metrics v1.12.3 h1:Fe6JHC6MSEKa+BtLhPN8WIvS+HKPzMc2evEpNeCGy7I=
github.com/VictoriaMetrics/metrics v1.12.3/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE=
github.com/VictoriaMetrics/metricsql v0.4.1 h1:WbVIfRNCK7HjrzayrpAl07mkh4kiDFZuECsh57rly2Q=
github.com/VictoriaMetrics/metricsql v0.4.1/go.mod h1:ylO7YITho/Iw6P71oEaGyHbO94bGoGtzWfLGqFhMIg8=
github.com/VictoriaMetrics/metricsql v0.4.2 h1:cLrPMK0IASCglRwHBwMAW+ooxG77vxlEkYheVc7gtqs=
github.com/VictoriaMetrics/metricsql v0.4.2/go.mod h1:ylO7YITho/Iw6P71oEaGyHbO94bGoGtzWfLGqFhMIg8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=

View file

@ -260,7 +260,7 @@ func (p *parser) parseWithArgExpr() (*withArgExpr, error) {
if !isIdentPrefix(p.lex.Token) {
return nil, fmt.Errorf(`withArgExpr: unexpected token %q; want "ident"`, p.lex.Token)
}
wa.Name = p.lex.Token
wa.Name = unescapeIdent(p.lex.Token)
if isAggrFunc(wa.Name) || IsRollupFunc(wa.Name) || IsTransformFunc(wa.Name) || isWith(wa.Name) {
return nil, fmt.Errorf(`withArgExpr: cannot use reserved name %q`, wa.Name)
}
@ -533,7 +533,7 @@ func (p *parser) parseAggrFuncExpr() (*AggrFuncExpr, error) {
}
var ae AggrFuncExpr
ae.Name = strings.ToLower(p.lex.Token)
ae.Name = strings.ToLower(unescapeIdent(p.lex.Token))
if err := p.lex.Next(); err != nil {
return nil, err
}
@ -772,7 +772,7 @@ func expandWithExpr(was []*withArgExpr, e Expr) (Expr, error) {
if !t.hasNonEmptyMetricGroup() {
return t, nil
}
k := string(appendEscapedIdent(nil, t.LabelFilters[0].Value))
k := t.LabelFilters[0].Value
wa := getWithArgExpr(was, k)
if wa == nil {
return t, nil
@ -956,7 +956,7 @@ func (p *parser) parseFuncExpr() (*FuncExpr, error) {
}
var fe FuncExpr
fe.Name = p.lex.Token
fe.Name = unescapeIdent(p.lex.Token)
if err := p.lex.Next(); err != nil {
return nil, err
}
@ -1008,7 +1008,7 @@ func (p *parser) parseIdentList() ([]string, error) {
if !isIdentPrefix(p.lex.Token) {
return nil, fmt.Errorf(`identList: unexpected token %q; want "ident"`, p.lex.Token)
}
idents = append(idents, p.lex.Token)
idents = append(idents, unescapeIdent(p.lex.Token))
if err := p.lex.Next(); err != nil {
return nil, err
}
@ -1115,7 +1115,7 @@ func (p *parser) parseLabelFilterExpr() (*labelFilterExpr, error) {
return nil, fmt.Errorf(`labelFilterExpr: unexpected token %q; want "ident"`, p.lex.Token)
}
var lfe labelFilterExpr
lfe.Label = p.lex.Token
lfe.Label = unescapeIdent(p.lex.Token)
if err := p.lex.Next(); err != nil {
return nil, err
}
@ -1167,12 +1167,8 @@ func (lfe *labelFilterExpr) toLabelFilter() (*LabelFilter, error) {
}
var lf LabelFilter
lf.Label = unescapeIdent(lfe.Label)
if lf.Label == "__name__" {
lf.Value = unescapeIdent(lfe.Value.S)
} else {
lf.Value = lfe.Value.S
}
lf.Label = lfe.Label
lf.Value = lfe.Value.S
lf.IsRegexp = lfe.IsRegexp
lf.IsNegative = lfe.IsNegative
if !lf.IsRegexp {
@ -1319,7 +1315,7 @@ func (p *parser) parseMetricExpr() (*MetricExpr, error) {
var lfe labelFilterExpr
lfe.Label = "__name__"
lfe.Value = &StringExpr{
tokens: []string{strconv.Quote(p.lex.Token)},
tokens: []string{strconv.Quote(unescapeIdent(p.lex.Token))},
}
me.labelFilters = append(me.labelFilters[:0], &lfe)
if err := p.lex.Next(); err != nil {
@ -1465,7 +1461,7 @@ func (me *ModifierExpr) AppendString(dst []byte) []byte {
dst = append(dst, me.Op...)
dst = append(dst, " ("...)
for i, arg := range me.Args {
dst = append(dst, arg...)
dst = appendEscapedIdent(dst, arg)
if i+1 < len(me.Args) {
dst = append(dst, ", "...)
}
@ -1497,7 +1493,7 @@ type FuncExpr struct {
// AppendString appends string representation of fe to dst and returns the result.
func (fe *FuncExpr) AppendString(dst []byte) []byte {
dst = append(dst, fe.Name...)
dst = appendEscapedIdent(dst, fe.Name)
dst = appendStringArgListExpr(dst, fe.Args)
return dst
}
@ -1522,7 +1518,7 @@ type AggrFuncExpr struct {
// AppendString appends string representation of ae to dst and returns the result.
func (ae *AggrFuncExpr) AppendString(dst []byte) []byte {
dst = append(dst, ae.Name...)
dst = appendEscapedIdent(dst, ae.Name)
dst = appendStringArgListExpr(dst, ae.Args)
if ae.Modifier.Op != "" {
dst = append(dst, ' ')
@ -1568,11 +1564,11 @@ type withArgExpr struct {
// AppendString appends string representation of wa to dst and returns the result.
func (wa *withArgExpr) AppendString(dst []byte) []byte {
dst = append(dst, wa.Name...)
dst = appendEscapedIdent(dst, wa.Name)
if len(wa.Args) > 0 {
dst = append(dst, '(')
for i, arg := range wa.Args {
dst = append(dst, arg...)
dst = appendEscapedIdent(dst, arg)
if i+1 < len(wa.Args) {
dst = append(dst, ',')
}

2
vendor/modules.txt vendored
View file

@ -16,7 +16,7 @@ github.com/VictoriaMetrics/fasthttp/fasthttputil
github.com/VictoriaMetrics/fasthttp/stackless
# github.com/VictoriaMetrics/metrics v1.12.3
github.com/VictoriaMetrics/metrics
# github.com/VictoriaMetrics/metricsql v0.4.1
# github.com/VictoriaMetrics/metricsql v0.4.2
github.com/VictoriaMetrics/metricsql
github.com/VictoriaMetrics/metricsql/binaryop
# github.com/aws/aws-sdk-go v1.34.14