Skip to content

Commit

Permalink
Update query snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 12, 2024
1 parent 582f175 commit 1ef8667
Showing 1 changed file with 120 additions and 32 deletions.
152 changes: 120 additions & 32 deletions posthog/queries/test/__snapshots__/test_trends.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -871,14 +871,18 @@
# ---
# name: TestTrends.test_dau_with_breakdown_filtering_with_sampling.1
'''
/* celery:posthog.tasks.tasks.sync_insight_caching_state */
SELECT team_id,
date_diff('second', max(timestamp), now()) AS age
FROM events
WHERE timestamp > date_sub(DAY, 3, now())
AND timestamp < now()
GROUP BY team_id
ORDER BY age;

SELECT replaceRegexpAll(JSONExtractRaw(properties, '$some_property'), '^"|"$', '') AS value,
count(*) as count
FROM events e SAMPLE 1.0
WHERE team_id = 99999
AND ((event = 'sign up'))
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-04 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestTrends.test_dau_with_breakdown_filtering_with_sampling.10
Expand Down Expand Up @@ -1043,38 +1047,122 @@
# ---
# name: TestTrends.test_dau_with_breakdown_filtering_with_sampling.2
'''
/* celery:posthog.tasks.tasks.sync_insight_caching_state */
SELECT team_id,
date_diff('second', max(timestamp), now()) AS age
FROM events
WHERE timestamp > date_sub(DAY, 3, now())
AND timestamp < now()
GROUP BY team_id
ORDER BY age;

SELECT groupArray(day_start) as date,
groupArray(count) AS total,
breakdown_value
FROM
(SELECT SUM(total) as count,
day_start,
breakdown_value
FROM
(SELECT *
FROM
(SELECT toUInt16(0) AS total,
ticks.day_start as day_start,
breakdown_value
FROM
(SELECT toStartOfDay(toDateTime('2020-01-04 23:59:59', 'UTC')) - toIntervalDay(number) as day_start
FROM numbers(8)
UNION ALL SELECT toStartOfDay(toDateTime('2019-12-28 00:00:00', 'UTC')) as day_start) as ticks
CROSS JOIN
(SELECT breakdown_value
FROM
(SELECT ['other_value', '$$_posthog_breakdown_null_$$', 'value'] as breakdown_value) ARRAY
JOIN breakdown_value) as sec
ORDER BY breakdown_value,
day_start
UNION ALL SELECT count(DISTINCT pdi.person_id) as total,
toStartOfDay(toTimeZone(toDateTime(timestamp, 'UTC'), 'UTC')) as day_start,
transform(ifNull(nullIf(replaceRegexpAll(JSONExtractRaw(properties, '$some_property'), '^"|"$', ''), ''), '$$_posthog_breakdown_null_$$'), (['other_value', '$$_posthog_breakdown_null_$$', 'value']), (['other_value', '$$_posthog_breakdown_null_$$', 'value']), '$$_posthog_breakdown_other_$$') as breakdown_value
FROM events e SAMPLE 1.0
INNER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) as pdi ON events.distinct_id = pdi.distinct_id
WHERE e.team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime(toStartOfDay(toDateTime('2019-12-28 00:00:00', 'UTC')), 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-04 23:59:59', 'UTC')
AND ((event = 'sign up'))
GROUP BY day_start,
breakdown_value))
GROUP BY day_start,
breakdown_value
ORDER BY breakdown_value,
day_start)
GROUP BY breakdown_value
ORDER BY breakdown_value
'''
# ---
# name: TestTrends.test_dau_with_breakdown_filtering_with_sampling.3
'''
/* celery:posthog.tasks.tasks.sync_insight_caching_state */
SELECT team_id,
date_diff('second', max(timestamp), now()) AS age
FROM events
WHERE timestamp > date_sub(DAY, 3, now())
AND timestamp < now()
GROUP BY team_id
ORDER BY age;

SELECT replaceRegexpAll(JSONExtractRaw(properties, '$some_property'), '^"|"$', '') AS value,
count(*) as count
FROM events e SAMPLE 1.0
WHERE team_id = 99999
AND event = 'sign up'
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-04 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestTrends.test_dau_with_breakdown_filtering_with_sampling.4
'''
/* celery:posthog.tasks.tasks.sync_insight_caching_state */
SELECT team_id,
date_diff('second', max(timestamp), now()) AS age
FROM events
WHERE timestamp > date_sub(DAY, 3, now())
AND timestamp < now()
GROUP BY team_id
ORDER BY age;

SELECT groupArray(day_start) as date,
groupArray(count) AS total,
breakdown_value
FROM
(SELECT SUM(total) as count,
day_start,
breakdown_value
FROM
(SELECT *
FROM
(SELECT toUInt16(0) AS total,
ticks.day_start as day_start,
breakdown_value
FROM
(SELECT toStartOfDay(toDateTime('2020-01-04 23:59:59', 'UTC')) - toIntervalDay(number) as day_start
FROM numbers(8)
UNION ALL SELECT toStartOfDay(toDateTime('2019-12-28 00:00:00', 'UTC')) as day_start) as ticks
CROSS JOIN
(SELECT breakdown_value
FROM
(SELECT ['other_value', '$$_posthog_breakdown_null_$$', 'value'] as breakdown_value) ARRAY
JOIN breakdown_value) as sec
ORDER BY breakdown_value,
day_start
UNION ALL SELECT count(DISTINCT pdi.person_id) as total,
toStartOfDay(toTimeZone(toDateTime(timestamp, 'UTC'), 'UTC')) as day_start,
transform(ifNull(nullIf(replaceRegexpAll(JSONExtractRaw(properties, '$some_property'), '^"|"$', ''), ''), '$$_posthog_breakdown_null_$$'), (['other_value', '$$_posthog_breakdown_null_$$', 'value']), (['other_value', '$$_posthog_breakdown_null_$$', 'value']), '$$_posthog_breakdown_other_$$') as breakdown_value
FROM events e SAMPLE 1.0
INNER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) as pdi ON events.distinct_id = pdi.distinct_id
WHERE e.team_id = 99999
AND event = 'sign up'
AND toTimeZone(timestamp, 'UTC') >= toDateTime(toStartOfDay(toDateTime('2019-12-28 00:00:00', 'UTC')), 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-04 23:59:59', 'UTC')
GROUP BY day_start,
breakdown_value))
GROUP BY day_start,
breakdown_value
ORDER BY breakdown_value,
day_start)
GROUP BY breakdown_value
ORDER BY breakdown_value
'''
# ---
# name: TestTrends.test_dau_with_breakdown_filtering_with_sampling.5
Expand Down

0 comments on commit 1ef8667

Please sign in to comment.