|
|
@ -7,6 +7,7 @@ import ( |
|
|
|
"runtime" |
|
|
|
"runtime" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/data" |
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/data" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/expr/mathexp/parse" |
|
|
|
"github.com/grafana/grafana/pkg/expr/mathexp/parse" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -201,6 +202,11 @@ func union(aResults, bResults Results) []*Union { |
|
|
|
} |
|
|
|
} |
|
|
|
if aValueLen == 1 || bValueLen == 1 { |
|
|
|
if aValueLen == 1 || bValueLen == 1 { |
|
|
|
if aResults.Values[0].Type() == parse.TypeNoData || bResults.Values[0].Type() == parse.TypeNoData { |
|
|
|
if aResults.Values[0].Type() == parse.TypeNoData || bResults.Values[0].Type() == parse.TypeNoData { |
|
|
|
|
|
|
|
unions = append(unions, &Union{ |
|
|
|
|
|
|
|
Labels: nil, |
|
|
|
|
|
|
|
A: aResults.Values[0], |
|
|
|
|
|
|
|
B: bResults.Values[0], |
|
|
|
|
|
|
|
}) |
|
|
|
return unions |
|
|
|
return unions |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -285,6 +291,8 @@ func (e *State) walkBinary(node *parse.BinaryNode) (Results, error) { |
|
|
|
// Scalar op Series
|
|
|
|
// Scalar op Series
|
|
|
|
case Series: |
|
|
|
case Series: |
|
|
|
value, err = e.biSeriesNumber(uni.Labels, node.OpStr, bt, aFloat, false) |
|
|
|
value, err = e.biSeriesNumber(uni.Labels, node.OpStr, bt, aFloat, false) |
|
|
|
|
|
|
|
case NoData: |
|
|
|
|
|
|
|
value = uni.B |
|
|
|
default: |
|
|
|
default: |
|
|
|
return res, fmt.Errorf("not implemented: binary %v on %T and %T", node.OpStr, uni.A, uni.B) |
|
|
|
return res, fmt.Errorf("not implemented: binary %v on %T and %T", node.OpStr, uni.A, uni.B) |
|
|
|
} |
|
|
|
} |
|
|
@ -301,6 +309,8 @@ func (e *State) walkBinary(node *parse.BinaryNode) (Results, error) { |
|
|
|
// case Series op Series
|
|
|
|
// case Series op Series
|
|
|
|
case Series: |
|
|
|
case Series: |
|
|
|
value, err = e.biSeriesSeries(uni.Labels, node.OpStr, at, bt) |
|
|
|
value, err = e.biSeriesSeries(uni.Labels, node.OpStr, at, bt) |
|
|
|
|
|
|
|
case NoData: |
|
|
|
|
|
|
|
value = uni.B |
|
|
|
default: |
|
|
|
default: |
|
|
|
return res, fmt.Errorf("not implemented: binary %v on %T and %T", node.OpStr, uni.A, uni.B) |
|
|
|
return res, fmt.Errorf("not implemented: binary %v on %T and %T", node.OpStr, uni.A, uni.B) |
|
|
|
} |
|
|
|
} |
|
|
@ -315,9 +325,13 @@ func (e *State) walkBinary(node *parse.BinaryNode) (Results, error) { |
|
|
|
value, err = e.biScalarNumber(uni.Labels, node.OpStr, at, bFloat, true) |
|
|
|
value, err = e.biScalarNumber(uni.Labels, node.OpStr, at, bFloat, true) |
|
|
|
case Series: |
|
|
|
case Series: |
|
|
|
value, err = e.biSeriesNumber(uni.Labels, node.OpStr, bt, aFloat, false) |
|
|
|
value, err = e.biSeriesNumber(uni.Labels, node.OpStr, bt, aFloat, false) |
|
|
|
|
|
|
|
case NoData: |
|
|
|
|
|
|
|
value = uni.B |
|
|
|
default: |
|
|
|
default: |
|
|
|
return res, fmt.Errorf("not implemented: binary %v on %T and %T", node.OpStr, uni.A, uni.B) |
|
|
|
return res, fmt.Errorf("not implemented: binary %v on %T and %T", node.OpStr, uni.A, uni.B) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case NoData: |
|
|
|
|
|
|
|
value = uni.A |
|
|
|
default: |
|
|
|
default: |
|
|
|
return res, fmt.Errorf("not implemented: binary %v on %T and %T", node.OpStr, uni.A, uni.B) |
|
|
|
return res, fmt.Errorf("not implemented: binary %v on %T and %T", node.OpStr, uni.A, uni.B) |
|
|
|
} |
|
|
|
} |
|
|
|