From deb5a3967f9ef8a96cb6a021388ce9c24e23f7a9 Mon Sep 17 00:00:00 2001 From: Ghazanfar-CFLT Date: Tue, 24 Jan 2023 20:18:31 +0530 Subject: [PATCH] Pass if the query doesn't have Builder or Settings --- 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{}))