Skip to content

Commit

Permalink
fix: reports aggregation query to select sample_event and sample_resp…
Browse files Browse the repository at this point in the history
…onse correctly (#5360)
  • Loading branch information
itsmihir authored Dec 10, 2024
1 parent f05fa25 commit cd94dac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions enterprise/reporting/reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ func (r *DefaultReporter) getReports(currentMs, aggregationIntervalMin int64, sy
SELECT
%s, MAX(reported_at),
COALESCE(
(ARRAY_AGG(sample_response ORDER BY id DESC) FILTER (WHERE sample_event != '{}'::jsonb))[1],
(ARRAY_AGG(sample_response ORDER BY id DESC) FILTER (WHERE (sample_event != '{}'::jsonb AND sample_event IS NOT NULL) OR (sample_response IS NOT NULL AND sample_response != '')))[1],
''
) AS sample_response,
COALESCE(
(ARRAY_AGG(sample_event ORDER BY id DESC) FILTER (WHERE sample_event != '{}'::jsonb))[1],
(ARRAY_AGG(sample_event ORDER BY id DESC) FILTER (WHERE (sample_event != '{}'::jsonb AND sample_event IS NOT NULL) OR (sample_response IS NOT NULL AND sample_response != '')))[1],
'{}'::jsonb
) AS sample_event,
SUM(count),
Expand Down

0 comments on commit cd94dac

Please sign in to comment.