From 6818ead52f2a0ebe780e229e9d4e33b070546307 Mon Sep 17 00:00:00 2001 From: Ghazanfar Date: Wed, 25 Jan 2023 00:21:30 +0530 Subject: [PATCH] Pass if the query doesn't have Builder or Settings (#138) Co-authored-by: Ghazanfar-CFLT --- pkg/druid.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/druid.go b/pkg/druid.go index d6355e8..0e15d91 100644 --- a/pkg/druid.go +++ b/pkg/druid.go @@ -392,6 +392,13 @@ func (ds *druidDatasource) prepareQuery(qry []byte, s *druidInstanceSettings) (d if err != nil { return nil, nil, err } + if q.Builder == nil || q.Settings == nil { + // Don't return an error here, as this isn't a user error + // Grafana seems to invoke this even before the user has entered any query + log.DefaultLogger.Debug("Invalid query issued to Druid Plugin: missing builder or settings", "query:", string(qry)) + return nil, nil, nil + } + var defaultQueryContext map[string]interface{} if defaultContextParameters, ok := s.defaultQuerySettings["contextParameters"]; ok { defaultQueryContext = ds.prepareQueryContext(defaultContextParameters.([]interface{}))