Skip to content

Commit

Permalink
check topn results size (#148)
Browse files Browse the repository at this point in the history
LGTM
  • Loading branch information
jbguerraz authored Mar 7, 2023
1 parent fe9a7a5 commit cf04100
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/druid.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func (ds *druidDatasource) executeQuery(queryRef string, q druidquerybuilder.Que
case "topN":
var tn []map[string]interface{}
err := json.Unmarshal(result, &tn)
if err == nil && len(tn) > 0 {
if err == nil && len(tn) > 0 && len(tn[0]["result"].([]interface{})) > 0 {
columns := []string{"timestamp"}
for c := range tn[0]["result"].([]interface{})[0].(map[string]interface{}) {
columns = append(columns, c)
Expand Down

0 comments on commit cf04100

Please sign in to comment.