SSE: Add noData type (#51973)
When there is a single frame with no fields (e.g. splunk datasource) SSE errors when trying to figure out the data type. This frame needs to exist since this is where the executedQueryString metadata exists. This adds a new return type to SSE to represent no data, so the original frame with its metadata can still be maintained.
This commit is contained in:
+10
-1
@@ -117,6 +117,8 @@ func (e *State) walkUnary(node *parse.UnaryNode) (Results, error) {
|
||||
newVal, err = e.unaryNumber(rt, node.OpStr)
|
||||
case Series:
|
||||
newVal, err = e.unarySeries(rt, node.OpStr)
|
||||
case NoData:
|
||||
newVal = NoData{}.New()
|
||||
default:
|
||||
return newResults, fmt.Errorf("can not perform a unary operation on type %v", rt.Type())
|
||||
}
|
||||
@@ -192,9 +194,16 @@ type Union struct {
|
||||
// number of tags.
|
||||
func union(aResults, bResults Results) []*Union {
|
||||
unions := []*Union{}
|
||||
if len(aResults.Values) == 0 || len(bResults.Values) == 0 {
|
||||
aValueLen := len(aResults.Values)
|
||||
bValueLen := len(bResults.Values)
|
||||
if aValueLen == 0 || bValueLen == 0 {
|
||||
return unions
|
||||
}
|
||||
if aValueLen == 1 || bValueLen == 1 {
|
||||
if aResults.Values[0].Type() == parse.TypeNoData || bResults.Values[0].Type() == parse.TypeNoData {
|
||||
return unions
|
||||
}
|
||||
}
|
||||
for _, a := range aResults.Values {
|
||||
for _, b := range bResults.Values {
|
||||
var labels data.Labels
|
||||
|
||||
Reference in New Issue
Block a user