Skip to content

Commit

Permalink
Move validation logic to parseCalculations.
Browse files Browse the repository at this point in the history
  • Loading branch information
notbdu committed Feb 12, 2019
1 parent 8e7c96a commit 9eec672
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions query/unparsed_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,14 @@ func (q *UnparsedQuery) validateGroupBy() error {
if q.TimeGranularity != nil {
return errTimeGranularityWithGroupBy
}
if len(q.Calculations) == 0 {
return errGroupByWithNoCalculations
}
return nil
}

func (q *UnparsedQuery) parseCalculations(opts ParseOptions) ([]Calculation, error) {
if len(q.Calculations) == 0 {
if len(q.GroupBy) > 0 {
return nil, errGroupByWithNoCalculations
}
return nil, nil
}
if err := q.validateCalculations(); err != nil {
Expand Down

0 comments on commit 9eec672

Please sign in to comment.