diff --git a/pkg/tsdb/sqleng/sql_engine.go b/pkg/tsdb/sqleng/sql_engine.go index 1aee1b548da..5fa2e35fd6a 100644 --- a/pkg/tsdb/sqleng/sql_engine.go +++ b/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