mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vendor: update github.com/VictoriaMetrics/metricsql from v0.2.10 to v0.3.0
This adds support for special integers in MetricsQL that start from 0x, 0b, 0o. This improves compatibility with PromQL - see https://promlabs.com/promql-compliance-test-results-victoriametrics/
This commit is contained in:
parent
bc8381613d
commit
ada2ae69ec
7 changed files with 49 additions and 20 deletions
2
go.mod
2
go.mod
|
@ -8,7 +8,7 @@ require (
|
|||
// like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b
|
||||
github.com/VictoriaMetrics/fasthttp v1.0.4
|
||||
github.com/VictoriaMetrics/metrics v1.12.2
|
||||
github.com/VictoriaMetrics/metricsql v0.2.10
|
||||
github.com/VictoriaMetrics/metricsql v0.3.0
|
||||
github.com/aws/aws-sdk-go v1.33.19
|
||||
github.com/cespare/xxhash/v2 v2.1.1
|
||||
github.com/golang/snappy v0.0.1
|
||||
|
|
7
go.sum
7
go.sum
|
@ -49,12 +49,10 @@ github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQu
|
|||
github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8=
|
||||
github.com/VictoriaMetrics/fasthttp v1.0.4 h1:Aw6UqmPc0v5PunYOpiiyf4hk5B9PTMswdTct/Bvh7Wk=
|
||||
github.com/VictoriaMetrics/fasthttp v1.0.4/go.mod h1:m5wCmg1dJN6s1B/lp8/dcKrnnM2l3DWB2eAGZGCTK3g=
|
||||
github.com/VictoriaMetrics/metrics v1.11.2 h1:t/ceLP6SvagUqypCKU7cI7+tQn54+TIV/tGoxihHvx8=
|
||||
github.com/VictoriaMetrics/metrics v1.11.2/go.mod h1:LU2j9qq7xqZYXz8tF3/RQnB2z2MbZms5TDiIg9/NHiQ=
|
||||
github.com/VictoriaMetrics/metrics v1.12.2 h1:SG8iAmqavDNuh7GIdHPoGHUhDL23KeKfvSZSozucNeA=
|
||||
github.com/VictoriaMetrics/metrics v1.12.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE=
|
||||
github.com/VictoriaMetrics/metricsql v0.2.10 h1:1z0cfVwjh9n6J0rM8znNQkTy0rIpB+VO2hqnggtYRoc=
|
||||
github.com/VictoriaMetrics/metricsql v0.2.10/go.mod h1:UIjd9S0W1UnTWlJdM0wLS+2pfuPqjwqKoK8yTos+WyE=
|
||||
github.com/VictoriaMetrics/metricsql v0.3.0 h1:610HmpZixn1KiQhV+/BNK/OAHE5M+8Fiy8LtI/xEguo=
|
||||
github.com/VictoriaMetrics/metricsql v0.3.0/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=
|
||||
|
@ -167,7 +165,6 @@ github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2Obdk
|
|||
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
||||
github.com/valyala/gozstd v1.7.0 h1:Ljh5c9zboqLhwTI33al32R72iCZfn0mCbVGcFWbGwRQ=
|
||||
github.com/valyala/gozstd v1.7.0/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ=
|
||||
github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto=
|
||||
github.com/valyala/histogram v1.1.2 h1:vOk5VrGjMBIoPR5k6wA8vBaC8toeJ8XO0yfRjFEc1h8=
|
||||
github.com/valyala/histogram v1.1.2/go.mod h1:CZAr6gK9dbD7hYx2s8WSPh0p5x5wETjC+2b3PJVtEdg=
|
||||
github.com/valyala/quicktemplate v1.6.2 h1:k0vgK7zlmFzqAoIBIOrhrfmZ6JoTGJlLRPLbkPGr2/M=
|
||||
|
|
2
vendor/github.com/VictoriaMetrics/metricsql/go.mod
generated
vendored
2
vendor/github.com/VictoriaMetrics/metricsql/go.mod
generated
vendored
|
@ -2,4 +2,4 @@ module github.com/VictoriaMetrics/metricsql
|
|||
|
||||
go 1.13
|
||||
|
||||
require github.com/VictoriaMetrics/metrics v1.11.2
|
||||
require github.com/VictoriaMetrics/metrics v1.12.2
|
||||
|
|
8
vendor/github.com/VictoriaMetrics/metricsql/go.sum
generated
vendored
8
vendor/github.com/VictoriaMetrics/metricsql/go.sum
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
github.com/VictoriaMetrics/metrics v1.11.2 h1:t/ceLP6SvagUqypCKU7cI7+tQn54+TIV/tGoxihHvx8=
|
||||
github.com/VictoriaMetrics/metrics v1.11.2/go.mod h1:LU2j9qq7xqZYXz8tF3/RQnB2z2MbZms5TDiIg9/NHiQ=
|
||||
github.com/VictoriaMetrics/metrics v1.12.2 h1:SG8iAmqavDNuh7GIdHPoGHUhDL23KeKfvSZSozucNeA=
|
||||
github.com/VictoriaMetrics/metrics v1.12.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE=
|
||||
github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI=
|
||||
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
||||
github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4KDg=
|
||||
github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto=
|
||||
github.com/valyala/histogram v1.1.2 h1:vOk5VrGjMBIoPR5k6wA8vBaC8toeJ8XO0yfRjFEc1h8=
|
||||
github.com/valyala/histogram v1.1.2/go.mod h1:CZAr6gK9dbD7hYx2s8WSPh0p5x5wETjC+2b3PJVtEdg=
|
||||
|
|
26
vendor/github.com/VictoriaMetrics/metricsql/lexer.go
generated
vendored
26
vendor/github.com/VictoriaMetrics/metricsql/lexer.go
generated
vendored
|
@ -149,6 +149,9 @@ func scanString(s string) (string, error) {
|
|||
func scanPositiveNumber(s string) (string, error) {
|
||||
// Scan integer part. It may be empty if fractional part exists.
|
||||
i := 0
|
||||
if n := scanSpecialIntegerPrefix(s); n > 0 {
|
||||
i += n
|
||||
}
|
||||
for i < len(s) && isDecimalChar(s[i]) {
|
||||
i++
|
||||
}
|
||||
|
@ -366,6 +369,29 @@ func isPositiveNumberPrefix(s string) bool {
|
|||
return isDecimalChar(s[1])
|
||||
}
|
||||
|
||||
func isSpecialIntegerPrefix(s string) bool {
|
||||
return scanSpecialIntegerPrefix(s) > 0
|
||||
}
|
||||
|
||||
func scanSpecialIntegerPrefix(s string) int {
|
||||
if len(s) < 1 || s[0] != '0' {
|
||||
return 0
|
||||
}
|
||||
s = strings.ToLower(s[1:])
|
||||
if len(s) == 0 {
|
||||
return 0
|
||||
}
|
||||
if isDecimalChar(s[0]) {
|
||||
// octal number: 0123
|
||||
return 1
|
||||
}
|
||||
if s[0] == 'x' || s[0] == 'o' || s[0] == 'b' {
|
||||
// 0x, 0o or 0b prefix
|
||||
return 2
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func isPositiveDuration(s string) bool {
|
||||
n := scanDuration(s, false)
|
||||
return n == len(s)
|
||||
|
|
22
vendor/github.com/VictoriaMetrics/metricsql/parser.go
generated
vendored
22
vendor/github.com/VictoriaMetrics/metricsql/parser.go
generated
vendored
|
@ -431,18 +431,24 @@ func (p *parser) parsePositiveNumberExpr() (*NumberExpr, error) {
|
|||
if !isPositiveNumberPrefix(p.lex.Token) && !isInfOrNaN(p.lex.Token) {
|
||||
return nil, fmt.Errorf(`positiveNumberExpr: unexpected token %q; want "number"`, p.lex.Token)
|
||||
}
|
||||
|
||||
n, err := strconv.ParseFloat(p.lex.Token, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(`positiveNumberExpr: cannot parse %q: %s`, p.lex.Token, err)
|
||||
var ne NumberExpr
|
||||
if isSpecialIntegerPrefix(p.lex.Token) {
|
||||
in, err := strconv.ParseInt(p.lex.Token, 0, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(`positiveNumberExpr: cannot parse integer %q: %s`, p.lex.Token, err)
|
||||
}
|
||||
ne.N = float64(in)
|
||||
} else {
|
||||
n, err := strconv.ParseFloat(p.lex.Token, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(`positiveNumberExpr: cannot parse %q: %s`, p.lex.Token, err)
|
||||
}
|
||||
ne.N = n
|
||||
}
|
||||
if err := p.lex.Next(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ne := &NumberExpr{
|
||||
N: n,
|
||||
}
|
||||
return ne, nil
|
||||
return &ne, nil
|
||||
}
|
||||
|
||||
func (p *parser) parseStringExpr() (*StringExpr, error) {
|
||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -16,7 +16,7 @@ github.com/VictoriaMetrics/fasthttp/fasthttputil
|
|||
github.com/VictoriaMetrics/fasthttp/stackless
|
||||
# github.com/VictoriaMetrics/metrics v1.12.2
|
||||
github.com/VictoriaMetrics/metrics
|
||||
# github.com/VictoriaMetrics/metricsql v0.2.10
|
||||
# github.com/VictoriaMetrics/metricsql v0.3.0
|
||||
github.com/VictoriaMetrics/metricsql
|
||||
github.com/VictoriaMetrics/metricsql/binaryop
|
||||
# github.com/aws/aws-sdk-go v1.33.19
|
||||
|
|
Loading…
Reference in a new issue