mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 00:26:36 +03:00
vendor: update https://github.com/VictoriaMetrics/metricsql from v0.85.0 to v0.86.0
It contains https://github.com/VictoriaMetrics/metricsql/pull/63 that reduce number of parentheses added. It should improve prettify functinality in vmui
This commit is contained in:
2
go.mod
2
go.mod
@@ -11,7 +11,7 @@ require (
|
||||
github.com/VictoriaMetrics/easyproto v1.2.0
|
||||
github.com/VictoriaMetrics/fastcache v1.13.3
|
||||
github.com/VictoriaMetrics/metrics v1.43.0
|
||||
github.com/VictoriaMetrics/metricsql v0.85.0
|
||||
github.com/VictoriaMetrics/metricsql v0.86.0
|
||||
github.com/aws/aws-sdk-go-v2 v1.41.1
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.8
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.1
|
||||
|
||||
4
go.sum
4
go.sum
@@ -60,8 +60,8 @@ github.com/VictoriaMetrics/fastcache v1.13.3 h1:rBabE0iIxcqKEMCwUmwHZ9dgEqXerg8F
|
||||
github.com/VictoriaMetrics/fastcache v1.13.3/go.mod h1:hHXhl4DA2fTL2HTZDJFXWgW0LNjo6B+4aj2Wmng3TjU=
|
||||
github.com/VictoriaMetrics/metrics v1.43.0 h1:mtzzl30hG28FtrsqfffKgtf5X3I8CdYCuToSr/bHw6M=
|
||||
github.com/VictoriaMetrics/metrics v1.43.0/go.mod h1:xDM82ULLYCYdFRgQ2JBxi8Uf1+8En1So9YUwlGTOqTc=
|
||||
github.com/VictoriaMetrics/metricsql v0.85.0 h1:xI+EfqsOgY0T2yd7p8hcYQ52LOtf+1i8fQQzQ+RGtZM=
|
||||
github.com/VictoriaMetrics/metricsql v0.85.0/go.mod h1:d4EisFO6ONP/HIGDYTAtwrejJBBeKGQYiRl095bS4QQ=
|
||||
github.com/VictoriaMetrics/metricsql v0.86.0 h1:IFD08amp+nkW6I+pB3+iyamewkIrbEojkQP4cmEbwkU=
|
||||
github.com/VictoriaMetrics/metricsql v0.86.0/go.mod h1:d4EisFO6ONP/HIGDYTAtwrejJBBeKGQYiRl095bS4QQ=
|
||||
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
||||
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
||||
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0=
|
||||
|
||||
35
vendor/github.com/VictoriaMetrics/metricsql/parser.go
generated
vendored
35
vendor/github.com/VictoriaMetrics/metricsql/parser.go
generated
vendored
@@ -1933,11 +1933,11 @@ func (be *BinaryOpExpr) appendStringNoKeepMetricNames(dst []byte) []byte {
|
||||
}
|
||||
|
||||
func (be *BinaryOpExpr) needLeftParens() bool {
|
||||
return needBinaryOpArgParens(be.Left)
|
||||
return needBinaryOpArgParens(be.Left, be.Op)
|
||||
}
|
||||
|
||||
func (be *BinaryOpExpr) needRightParens() bool {
|
||||
if needBinaryOpArgParens(be.Right) {
|
||||
if needBinaryOpArgParens(be.Right, be.Op) {
|
||||
return true
|
||||
}
|
||||
switch t := be.Right.(type) {
|
||||
@@ -1974,10 +1974,17 @@ func (be *BinaryOpExpr) appendModifiers(dst []byte) []byte {
|
||||
return dst
|
||||
}
|
||||
|
||||
func needBinaryOpArgParens(arg Expr) bool {
|
||||
func needBinaryOpArgParens(arg Expr, parentOp string) bool {
|
||||
switch t := arg.(type) {
|
||||
case *BinaryOpExpr:
|
||||
return true
|
||||
// Parens are required when the child op priority not equal to parent o one.
|
||||
// For example, a + b / c - d should be a + (b / c) - d.
|
||||
if binaryOpPriority(t.Op) != binaryOpPriority(parentOp) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Same op: parens are only needed when the sub-expression is not a simple leaf chain.
|
||||
return !isBinaryOpLeafSimple(t)
|
||||
case *RollupExpr:
|
||||
if be, ok := t.Expr.(*BinaryOpExpr); ok && be.KeepMetricNames {
|
||||
return true
|
||||
@@ -1988,6 +1995,26 @@ func needBinaryOpArgParens(arg Expr) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func isBinaryOpLeafSimple(arg Expr) bool {
|
||||
switch t := arg.(type) {
|
||||
case *NumberExpr:
|
||||
return true
|
||||
case *MetricExpr:
|
||||
metricName := t.getMetricName()
|
||||
// Parens should be added if metric name equals to a reserved word, such as group_left
|
||||
// For example, a + group_left should become a + (group_left). Otherwise, query won't be parsed.
|
||||
return !isReservedBinaryOpIdent(metricName)
|
||||
case *BinaryOpExpr:
|
||||
if t.GroupModifier.Op != "" || t.KeepMetricNames || t.JoinModifier.Op != "" {
|
||||
return false
|
||||
}
|
||||
|
||||
return isBinaryOpLeafSimple(t.Left) && isBinaryOpLeafSimple(t.Right)
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func isReservedBinaryOpIdent(s string) bool {
|
||||
return isBinaryOpGroupModifier(s) || isBinaryOpJoinModifier(s) || isBinaryOpBoolModifier(s) || isPrefixModifier(s)
|
||||
}
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -145,7 +145,7 @@ github.com/VictoriaMetrics/fastcache
|
||||
# github.com/VictoriaMetrics/metrics v1.43.0
|
||||
## explicit; go 1.24.0
|
||||
github.com/VictoriaMetrics/metrics
|
||||
# github.com/VictoriaMetrics/metricsql v0.85.0
|
||||
# github.com/VictoriaMetrics/metricsql v0.86.0
|
||||
## explicit; go 1.24.2
|
||||
github.com/VictoriaMetrics/metricsql
|
||||
github.com/VictoriaMetrics/metricsql/binaryop
|
||||
|
||||
Reference in New Issue
Block a user