From 597373f7fdaec2f2e1ef3d82287f31f658639fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Bie=C5=84kowski?= Date: Thu, 2 Feb 2023 12:10:11 +0100 Subject: [PATCH] Minor grafadruid fixes --- pkg/tsdb/druid/druid.go | 8 +++----- pkg/tsdb/druid/result/common.go | 3 ++- pkg/tsdb/druid/result/timeseries.go | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/tsdb/druid/druid.go b/pkg/tsdb/druid/druid.go index a19c3f3a4a6c..91a50ca7a386 100644 --- a/pkg/tsdb/druid/druid.go +++ b/pkg/tsdb/druid/druid.go @@ -451,11 +451,9 @@ func (ds *Service) prepareQuery(qry []byte, s *druidInstanceSettings) (druidquer func (ds *Service) prepareQueryContext(parameters []interface{}) map[string]interface{} { ctx := make(map[string]interface{}) - if parameters != nil { - for _, parameter := range parameters { - p := parameter.(map[string]interface{}) - ctx[p["name"].(string)] = p["value"] - } + for _, parameter := range parameters { + p := parameter.(map[string]interface{}) + ctx[p["name"].(string)] = p["value"] } return ctx } diff --git a/pkg/tsdb/druid/result/common.go b/pkg/tsdb/druid/result/common.go index 7926a59ac07b..5d15a866c8d6 100644 --- a/pkg/tsdb/druid/result/common.go +++ b/pkg/tsdb/druid/result/common.go @@ -1,6 +1,7 @@ package result import ( + "fmt" "time" "github.com/grafana/grafana-plugin-sdk-go/backend/log" @@ -75,7 +76,7 @@ func toTypedResults(raw []interface{}) interface{} { return results default: // TODO better error handling - log.DefaultLogger.Debug("Unsupported value %T", raw[0]) + log.DefaultLogger.Debug(fmt.Sprintf("Unsupported type %T", raw[0])) return nil } } diff --git a/pkg/tsdb/druid/result/timeseries.go b/pkg/tsdb/druid/result/timeseries.go index 47e497522e54..ec9e20e64fa5 100644 --- a/pkg/tsdb/druid/result/timeseries.go +++ b/pkg/tsdb/druid/result/timeseries.go @@ -47,7 +47,7 @@ type TimeseriesRecord struct { } // Columns returns list of columns for given record. -// The first column will always be "timestamp" followed by other columns sorter +// The first column will always be "timestamp" followed by other columns sorted // alphabetically. func (t *TimeseriesRecord) Columns() []string { columns := make([]string, len(t.Result)+1)