Skip to content

Commit

Permalink
fix empty result bug
Browse files Browse the repository at this point in the history
  • Loading branch information
baxiry committed Aug 24, 2024
1 parent ccf5257 commit 535d7eb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions engine/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,14 @@ func aggrigate(query gjson.Result) string {
result += val + ","
}
}
if len(result) == 1 {
return `[]`

ln := len(result)
if ln == 1 {
return "[]"
}

return result[:len(result)-1] + "]"
return result[:ln-1] + "]"

}

func sum(_id string, field gjson.Result, records []string) (mp map[string]float64, err error) {
Expand Down

0 comments on commit 535d7eb

Please sign in to comment.