SQL Datasources: Allow multiple string/labels columns with time series (#36485)

for #36370
pull/36823/head^2
Kyle Brandt 4 years ago committed by GitHub
parent aa3a46272f
commit 3ab9249f16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      pkg/tsdb/sqleng/sql_engine.go

@ -173,7 +173,7 @@ func (e *dataPlugin) DataQuery(ctx context.Context, dsInfo *models.DataSource,
return result, nil
}
//nolint: staticcheck // plugins.DataQueryResult deprecated
//nolint: staticcheck,gocyclo // plugins.DataQueryResult deprecated
func (e *dataPlugin) executeQuery(query plugins.DataSubQuery, wg *sync.WaitGroup, queryContext plugins.DataQuery,
ch chan plugins.DataQueryResult) {
defer wg.Done()
@ -292,6 +292,10 @@ func (e *dataPlugin) executeQuery(query plugins.DataSubQuery, wg *sync.WaitGroup
continue
}
if t := frame.Fields[i].Type(); t == data.FieldTypeString || t == data.FieldTypeNullableString {
continue
}
var err error
if frame, err = convertSQLValueColumnToFloat(frame, i); err != nil {
errAppendDebug("convert value to float failed", err, interpolatedQuery)
@ -892,7 +896,7 @@ func convertSQLValueColumnToFloat(frame *data.Frame, Index int) (*data.Frame, er
default:
convertUnknownToZero(frame.Fields[Index], newField)
frame.Fields[Index] = newField
return frame, fmt.Errorf("metricIndex %d type can't be converted to float", Index)
return frame, fmt.Errorf("metricIndex %d type %s can't be converted to float", Index, valueType)
}
frame.Fields[Index] = newField

Loading…
Cancel
Save