mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
chore(tests): add pytest-randomly plugin to randomize test run order (#12307)
* chore(tests): add pytest-randomly plugin to randomize test run order * Update snapshots * Update snapshots * Update snapshots Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
---
|
||||
# name: test_parse_groups_persons_edge_case_with_single_filter
|
||||
<class 'tuple'> (
|
||||
'AND ( has(%(vglobalperson_0)s, "pmat_email"))',
|
||||
'AND ( has(%(vglobalperson_0)s, replaceRegexpAll(JSONExtractRaw(person_props, %(kglobalperson_0)s), \'^"|"$\', \'\')))',
|
||||
<class 'dict'> {
|
||||
'kglobalperson_0': 'email',
|
||||
'vglobalperson_0': <class 'list'> [
|
||||
@@ -119,7 +119,7 @@
|
||||
---
|
||||
# name: test_parse_prop_clauses_defaults.2
|
||||
<class 'tuple'> (
|
||||
'AND ( has(%(vglobal_0)s, replaceRegexpAll(JSONExtractRaw(properties, %(kglobal_0)s), \'^"|"$\', \'\')) AND argMax(person."pmat_email", _timestamp) ILIKE %(vpersonquery_global_1)s)',
|
||||
'AND ( has(%(vglobal_0)s, replaceRegexpAll(JSONExtractRaw(properties, %(kglobal_0)s), \'^"|"$\', \'\')) AND replaceRegexpAll(JSONExtractRaw(argMax(person.properties, _timestamp), %(kpersonquery_global_1)s), \'^"|"$\', \'\') ILIKE %(vpersonquery_global_1)s)',
|
||||
<class 'dict'> {
|
||||
'kglobal_0': 'event_prop',
|
||||
'kpersonquery_global_1': 'email',
|
||||
|
||||
@@ -2992,8 +2992,7 @@
|
||||
timestamp,
|
||||
steps,
|
||||
final_timestamp,
|
||||
first_timestamp,
|
||||
group0_properties
|
||||
first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3001,8 +3000,7 @@
|
||||
median(step_1_conversion_time) step_1_median_conversion_time_inner ,
|
||||
argMax(latest_0, steps) as timestamp,
|
||||
argMax(latest_1, steps) as final_timestamp,
|
||||
argMax(latest_0, steps) as first_timestamp,
|
||||
any(group0_properties) as group0_properties
|
||||
argMax(latest_0, steps) as first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3010,15 +3008,13 @@
|
||||
step_1_conversion_time ,
|
||||
latest_0,
|
||||
latest_1,
|
||||
latest_0,
|
||||
group0_properties
|
||||
latest_0
|
||||
FROM
|
||||
(SELECT *,
|
||||
if(latest_0 <= latest_1
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, 2, 1) AS steps ,
|
||||
if(isNotNull(latest_1)
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time ,
|
||||
group0_properties
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
@@ -3026,30 +3022,25 @@
|
||||
latest_0,
|
||||
step_1,
|
||||
min(latest_1) over (PARTITION by aggregation_target
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1 ,
|
||||
group0_properties
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
if(event = 'user signed up', 1, 0) as step_0,
|
||||
if(step_0 = 1, timestamp, null) as latest_0,
|
||||
if(event = 'paid', 1, 0) as step_1,
|
||||
if(step_1 = 1, timestamp, null) as latest_1 ,
|
||||
group0_properties
|
||||
if(step_1 = 1, timestamp, null) as latest_1
|
||||
FROM
|
||||
(SELECT e.event as event,
|
||||
e.team_id as team_id,
|
||||
e.distinct_id as distinct_id,
|
||||
e.timestamp as timestamp,
|
||||
e."$group_0" as aggregation_target,
|
||||
e.group0_properties AS group0_properties,
|
||||
e.person_id as person_id
|
||||
e."$group_0" as aggregation_target
|
||||
FROM events e
|
||||
WHERE team_id = 2
|
||||
AND event IN ['paid', 'user signed up']
|
||||
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
|
||||
AND toDateTime(timestamp, 'UTC') <= toDateTime('2020-01-14 23:59:59', 'UTC')
|
||||
AND e.person_id != toUUIDOrZero('') ) events
|
||||
AND toDateTime(timestamp, 'UTC') <= toDateTime('2020-01-14 23:59:59', 'UTC') ) events
|
||||
WHERE (step_0 = 1
|
||||
OR step_1 = 1) ))
|
||||
WHERE step_0 = 1 SETTINGS allow_experimental_window_functions = 1 ))
|
||||
@@ -3065,8 +3056,15 @@
|
||||
FROM
|
||||
(SELECT actor_id,
|
||||
funnel_actors.steps as steps,
|
||||
arrayJoin(arrayZip(['industry'], [replaceRegexpAll(JSONExtractRaw(group0_properties, 'industry'), '^"|"$', '')])) as prop
|
||||
FROM funnel_actors) aggregation_target_with_props
|
||||
arrayJoin(arrayZip(['industry'], [replaceRegexpAll(JSONExtractRaw(groups_0.group_properties_0, 'industry'), '^"|"$', '')])) as prop
|
||||
FROM funnel_actors
|
||||
INNER JOIN
|
||||
(SELECT group_key,
|
||||
argMax(group_properties, _timestamp) AS group_properties_0
|
||||
FROM groups
|
||||
WHERE team_id = 2
|
||||
AND group_type_index = 0
|
||||
GROUP BY group_key) groups_0 ON funnel_actors.actor_id == groups_0.group_key) aggregation_target_with_props
|
||||
GROUP BY prop.1,
|
||||
prop.2
|
||||
HAVING prop.1 NOT IN []
|
||||
@@ -3084,8 +3082,7 @@
|
||||
timestamp,
|
||||
steps,
|
||||
final_timestamp,
|
||||
first_timestamp,
|
||||
group0_properties
|
||||
first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3093,8 +3090,7 @@
|
||||
median(step_1_conversion_time) step_1_median_conversion_time_inner ,
|
||||
argMax(latest_0, steps) as timestamp,
|
||||
argMax(latest_1, steps) as final_timestamp,
|
||||
argMax(latest_0, steps) as first_timestamp,
|
||||
any(group0_properties) as group0_properties
|
||||
argMax(latest_0, steps) as first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3102,15 +3098,13 @@
|
||||
step_1_conversion_time ,
|
||||
latest_0,
|
||||
latest_1,
|
||||
latest_0,
|
||||
group0_properties
|
||||
latest_0
|
||||
FROM
|
||||
(SELECT *,
|
||||
if(latest_0 <= latest_1
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, 2, 1) AS steps ,
|
||||
if(isNotNull(latest_1)
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time ,
|
||||
group0_properties
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
@@ -3118,32 +3112,34 @@
|
||||
latest_0,
|
||||
step_1,
|
||||
min(latest_1) over (PARTITION by aggregation_target
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1 ,
|
||||
group0_properties
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
if(event = 'user signed up', 1, 0) as step_0,
|
||||
if(step_0 = 1, timestamp, null) as latest_0,
|
||||
if(event = 'paid', 1, 0) as step_1,
|
||||
if(step_1 = 1, timestamp, null) as latest_1 ,
|
||||
group0_properties
|
||||
if(step_1 = 1, timestamp, null) as latest_1
|
||||
FROM
|
||||
(SELECT e.event as event,
|
||||
e.team_id as team_id,
|
||||
e.distinct_id as distinct_id,
|
||||
e.timestamp as timestamp,
|
||||
e."$group_0" as aggregation_target,
|
||||
e.group0_properties AS group0_properties,
|
||||
e.person_id as person_id,
|
||||
e."group0_properties" as "group0_properties"
|
||||
groups_0.group_properties_0 as group_properties_0
|
||||
FROM events e
|
||||
INNER JOIN
|
||||
(SELECT group_key,
|
||||
argMax(group_properties, _timestamp) AS group_properties_0
|
||||
FROM groups
|
||||
WHERE team_id = 2
|
||||
AND group_type_index = 0
|
||||
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
|
||||
WHERE team_id = 2
|
||||
AND event IN ['paid', 'user signed up']
|
||||
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
|
||||
AND toDateTime(timestamp, 'UTC') <= toDateTime('2020-01-14 23:59:59', 'UTC')
|
||||
AND (has(['positive'], replaceRegexpAll(JSONExtractRaw(group0_properties, 'industry'), '^"|"$', '')))
|
||||
AND e.person_id != toUUIDOrZero('') ) events
|
||||
AND (has(['positive'], replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', ''))) ) events
|
||||
WHERE (step_0 = 1
|
||||
OR step_1 = 1) ))
|
||||
WHERE step_0 = 1 SETTINGS allow_experimental_window_functions = 1 ))
|
||||
@@ -3169,8 +3165,7 @@
|
||||
timestamp,
|
||||
steps,
|
||||
final_timestamp,
|
||||
first_timestamp,
|
||||
group0_properties
|
||||
first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3178,8 +3173,7 @@
|
||||
median(step_1_conversion_time) step_1_median_conversion_time_inner ,
|
||||
argMax(latest_0, steps) as timestamp,
|
||||
argMax(latest_1, steps) as final_timestamp,
|
||||
argMax(latest_0, steps) as first_timestamp,
|
||||
any(group0_properties) as group0_properties
|
||||
argMax(latest_0, steps) as first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3187,15 +3181,13 @@
|
||||
step_1_conversion_time ,
|
||||
latest_0,
|
||||
latest_1,
|
||||
latest_0,
|
||||
group0_properties
|
||||
latest_0
|
||||
FROM
|
||||
(SELECT *,
|
||||
if(latest_0 <= latest_1
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, 2, 1) AS steps ,
|
||||
if(isNotNull(latest_1)
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time ,
|
||||
group0_properties
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
@@ -3203,32 +3195,34 @@
|
||||
latest_0,
|
||||
step_1,
|
||||
min(latest_1) over (PARTITION by aggregation_target
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1 ,
|
||||
group0_properties
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
if(event = 'user signed up', 1, 0) as step_0,
|
||||
if(step_0 = 1, timestamp, null) as latest_0,
|
||||
if(event = 'paid', 1, 0) as step_1,
|
||||
if(step_1 = 1, timestamp, null) as latest_1 ,
|
||||
group0_properties
|
||||
if(step_1 = 1, timestamp, null) as latest_1
|
||||
FROM
|
||||
(SELECT e.event as event,
|
||||
e.team_id as team_id,
|
||||
e.distinct_id as distinct_id,
|
||||
e.timestamp as timestamp,
|
||||
e."$group_0" as aggregation_target,
|
||||
e.group0_properties AS group0_properties,
|
||||
e.person_id as person_id,
|
||||
e."group0_properties" as "group0_properties"
|
||||
groups_0.group_properties_0 as group_properties_0
|
||||
FROM events e
|
||||
INNER JOIN
|
||||
(SELECT group_key,
|
||||
argMax(group_properties, _timestamp) AS group_properties_0
|
||||
FROM groups
|
||||
WHERE team_id = 2
|
||||
AND group_type_index = 0
|
||||
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
|
||||
WHERE team_id = 2
|
||||
AND event IN ['paid', 'user signed up']
|
||||
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
|
||||
AND toDateTime(timestamp, 'UTC') <= toDateTime('2020-01-14 23:59:59', 'UTC')
|
||||
AND (has(['positive'], replaceRegexpAll(JSONExtractRaw(group0_properties, 'industry'), '^"|"$', '')))
|
||||
AND e.person_id != toUUIDOrZero('') ) events
|
||||
AND (has(['positive'], replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', ''))) ) events
|
||||
WHERE (step_0 = 1
|
||||
OR step_1 = 1) ))
|
||||
WHERE step_0 = 1 SETTINGS allow_experimental_window_functions = 1 ))
|
||||
@@ -3254,8 +3248,7 @@
|
||||
timestamp,
|
||||
steps,
|
||||
final_timestamp,
|
||||
first_timestamp,
|
||||
group0_properties
|
||||
first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3263,8 +3256,7 @@
|
||||
median(step_1_conversion_time) step_1_median_conversion_time_inner ,
|
||||
argMax(latest_0, steps) as timestamp,
|
||||
argMax(latest_1, steps) as final_timestamp,
|
||||
argMax(latest_0, steps) as first_timestamp,
|
||||
any(group0_properties) as group0_properties
|
||||
argMax(latest_0, steps) as first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3272,15 +3264,13 @@
|
||||
step_1_conversion_time ,
|
||||
latest_0,
|
||||
latest_1,
|
||||
latest_0,
|
||||
group0_properties
|
||||
latest_0
|
||||
FROM
|
||||
(SELECT *,
|
||||
if(latest_0 <= latest_1
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, 2, 1) AS steps ,
|
||||
if(isNotNull(latest_1)
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time ,
|
||||
group0_properties
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
@@ -3288,32 +3278,34 @@
|
||||
latest_0,
|
||||
step_1,
|
||||
min(latest_1) over (PARTITION by aggregation_target
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1 ,
|
||||
group0_properties
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
if(event = 'user signed up', 1, 0) as step_0,
|
||||
if(step_0 = 1, timestamp, null) as latest_0,
|
||||
if(event = 'paid', 1, 0) as step_1,
|
||||
if(step_1 = 1, timestamp, null) as latest_1 ,
|
||||
group0_properties
|
||||
if(step_1 = 1, timestamp, null) as latest_1
|
||||
FROM
|
||||
(SELECT e.event as event,
|
||||
e.team_id as team_id,
|
||||
e.distinct_id as distinct_id,
|
||||
e.timestamp as timestamp,
|
||||
e."$group_0" as aggregation_target,
|
||||
e.group0_properties AS group0_properties,
|
||||
e.person_id as person_id,
|
||||
e."group0_properties" as "group0_properties"
|
||||
groups_0.group_properties_0 as group_properties_0
|
||||
FROM events e
|
||||
INNER JOIN
|
||||
(SELECT group_key,
|
||||
argMax(group_properties, _timestamp) AS group_properties_0
|
||||
FROM groups
|
||||
WHERE team_id = 2
|
||||
AND group_type_index = 0
|
||||
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
|
||||
WHERE team_id = 2
|
||||
AND event IN ['paid', 'user signed up']
|
||||
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
|
||||
AND toDateTime(timestamp, 'UTC') <= toDateTime('2020-01-14 23:59:59', 'UTC')
|
||||
AND (has(['negative'], replaceRegexpAll(JSONExtractRaw(group0_properties, 'industry'), '^"|"$', '')))
|
||||
AND e.person_id != toUUIDOrZero('') ) events
|
||||
AND (has(['negative'], replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', ''))) ) events
|
||||
WHERE (step_0 = 1
|
||||
OR step_1 = 1) ))
|
||||
WHERE step_0 = 1 SETTINGS allow_experimental_window_functions = 1 ))
|
||||
@@ -3339,8 +3331,7 @@
|
||||
timestamp,
|
||||
steps,
|
||||
final_timestamp,
|
||||
first_timestamp,
|
||||
group0_properties
|
||||
first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3348,8 +3339,7 @@
|
||||
median(step_1_conversion_time) step_1_median_conversion_time_inner ,
|
||||
argMax(latest_0, steps) as timestamp,
|
||||
argMax(latest_1, steps) as final_timestamp,
|
||||
argMax(latest_0, steps) as first_timestamp,
|
||||
any(group0_properties) as group0_properties
|
||||
argMax(latest_0, steps) as first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3357,15 +3347,13 @@
|
||||
step_1_conversion_time ,
|
||||
latest_0,
|
||||
latest_1,
|
||||
latest_0,
|
||||
group0_properties
|
||||
latest_0
|
||||
FROM
|
||||
(SELECT *,
|
||||
if(latest_0 <= latest_1
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, 2, 1) AS steps ,
|
||||
if(isNotNull(latest_1)
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time ,
|
||||
group0_properties
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
@@ -3373,32 +3361,34 @@
|
||||
latest_0,
|
||||
step_1,
|
||||
min(latest_1) over (PARTITION by aggregation_target
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1 ,
|
||||
group0_properties
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
if(event = 'user signed up', 1, 0) as step_0,
|
||||
if(step_0 = 1, timestamp, null) as latest_0,
|
||||
if(event = 'paid', 1, 0) as step_1,
|
||||
if(step_1 = 1, timestamp, null) as latest_1 ,
|
||||
group0_properties
|
||||
if(step_1 = 1, timestamp, null) as latest_1
|
||||
FROM
|
||||
(SELECT e.event as event,
|
||||
e.team_id as team_id,
|
||||
e.distinct_id as distinct_id,
|
||||
e.timestamp as timestamp,
|
||||
e."$group_0" as aggregation_target,
|
||||
e.group0_properties AS group0_properties,
|
||||
e.person_id as person_id,
|
||||
e."group0_properties" as "group0_properties"
|
||||
groups_0.group_properties_0 as group_properties_0
|
||||
FROM events e
|
||||
INNER JOIN
|
||||
(SELECT group_key,
|
||||
argMax(group_properties, _timestamp) AS group_properties_0
|
||||
FROM groups
|
||||
WHERE team_id = 2
|
||||
AND group_type_index = 0
|
||||
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
|
||||
WHERE team_id = 2
|
||||
AND event IN ['paid', 'user signed up']
|
||||
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
|
||||
AND toDateTime(timestamp, 'UTC') <= toDateTime('2020-01-14 23:59:59', 'UTC')
|
||||
AND (has(['negative'], replaceRegexpAll(JSONExtractRaw(group0_properties, 'industry'), '^"|"$', '')))
|
||||
AND e.person_id != toUUIDOrZero('') ) events
|
||||
AND (has(['negative'], replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', ''))) ) events
|
||||
WHERE (step_0 = 1
|
||||
OR step_1 = 1) ))
|
||||
WHERE step_0 = 1 SETTINGS allow_experimental_window_functions = 1 ))
|
||||
@@ -3424,8 +3414,7 @@
|
||||
timestamp,
|
||||
steps,
|
||||
final_timestamp,
|
||||
first_timestamp,
|
||||
group0_properties
|
||||
first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3433,8 +3422,7 @@
|
||||
median(step_1_conversion_time) step_1_median_conversion_time_inner ,
|
||||
argMax(latest_0, steps) as timestamp,
|
||||
argMax(latest_1, steps) as final_timestamp,
|
||||
argMax(latest_0, steps) as first_timestamp,
|
||||
any(group0_properties) as group0_properties
|
||||
argMax(latest_0, steps) as first_timestamp
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
steps,
|
||||
@@ -3442,15 +3430,13 @@
|
||||
step_1_conversion_time ,
|
||||
latest_0,
|
||||
latest_1,
|
||||
latest_0,
|
||||
group0_properties
|
||||
latest_0
|
||||
FROM
|
||||
(SELECT *,
|
||||
if(latest_0 <= latest_1
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, 2, 1) AS steps ,
|
||||
if(isNotNull(latest_1)
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time ,
|
||||
group0_properties
|
||||
AND latest_1 <= latest_0 + INTERVAL 14 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
@@ -3458,30 +3444,25 @@
|
||||
latest_0,
|
||||
step_1,
|
||||
min(latest_1) over (PARTITION by aggregation_target
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1 ,
|
||||
group0_properties
|
||||
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1
|
||||
FROM
|
||||
(SELECT aggregation_target,
|
||||
timestamp,
|
||||
if(event = 'user signed up', 1, 0) as step_0,
|
||||
if(step_0 = 1, timestamp, null) as latest_0,
|
||||
if(event = 'paid', 1, 0) as step_1,
|
||||
if(step_1 = 1, timestamp, null) as latest_1 ,
|
||||
group0_properties
|
||||
if(step_1 = 1, timestamp, null) as latest_1
|
||||
FROM
|
||||
(SELECT e.event as event,
|
||||
e.team_id as team_id,
|
||||
e.distinct_id as distinct_id,
|
||||
e.timestamp as timestamp,
|
||||
e."$group_0" as aggregation_target,
|
||||
e.group0_properties AS group0_properties,
|
||||
e.person_id as person_id
|
||||
e."$group_0" as aggregation_target
|
||||
FROM events e
|
||||
WHERE team_id = 2
|
||||
AND event IN ['paid', 'user signed up']
|
||||
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
|
||||
AND toDateTime(timestamp, 'UTC') <= toDateTime('2020-01-14 23:59:59', 'UTC')
|
||||
AND e.person_id != toUUIDOrZero('') ) events
|
||||
AND toDateTime(timestamp, 'UTC') <= toDateTime('2020-01-14 23:59:59', 'UTC') ) events
|
||||
WHERE (step_0 = 1
|
||||
OR step_1 = 1) ))
|
||||
WHERE step_0 = 1 SETTINGS allow_experimental_window_functions = 1 ))
|
||||
@@ -3497,9 +3478,16 @@
|
||||
FROM
|
||||
(SELECT actor_id,
|
||||
funnel_actors.steps as steps,
|
||||
arrayMap(x -> x.1, JSONExtractKeysAndValuesRaw(group0_properties)) as person_prop_keys,
|
||||
arrayJoin(arrayZip(person_prop_keys, arrayMap(x -> replaceRegexpAll(JSONExtractRaw(group0_properties, x), '^"|"$', ''), person_prop_keys))) as prop
|
||||
FROM funnel_actors) aggregation_target_with_props
|
||||
arrayMap(x -> x.1, JSONExtractKeysAndValuesRaw(groups_0.group_properties_0)) as person_prop_keys,
|
||||
arrayJoin(arrayZip(person_prop_keys, arrayMap(x -> replaceRegexpAll(JSONExtractRaw(groups_0.group_properties_0, x), '^"|"$', ''), person_prop_keys))) as prop
|
||||
FROM funnel_actors
|
||||
INNER JOIN
|
||||
(SELECT group_key,
|
||||
argMax(group_properties, _timestamp) AS group_properties_0
|
||||
FROM groups
|
||||
WHERE team_id = 2
|
||||
AND group_type_index = 0
|
||||
GROUP BY group_key) groups_0 ON funnel_actors.actor_id == groups_0.group_key) aggregation_target_with_props
|
||||
GROUP BY prop.1,
|
||||
prop.2
|
||||
HAVING prop.1 NOT IN []
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_funnel_correlation_on_event_with_recordings
|
||||
'
|
||||
WITH funnel_actors as
|
||||
/* request:1 */ WITH funnel_actors as
|
||||
(SELECT aggregation_target AS actor_id,
|
||||
final_matching_events as matching_events,
|
||||
timestamp,
|
||||
@@ -110,10 +110,10 @@
|
||||
HAVING steps = max_steps SETTINGS allow_experimental_window_functions = 1)
|
||||
WHERE steps IN [1, 2]
|
||||
ORDER BY aggregation_target SETTINGS allow_experimental_window_functions = 1),
|
||||
toDateTime('2021-01-08 23:59:59', 'UTC') AS date_to,
|
||||
toDateTime('2021-01-01 00:00:00', 'UTC') AS date_from,
|
||||
2 AS target_step,
|
||||
['$pageview', 'insight analyzed'] as funnel_step_names
|
||||
toDateTime('2021-01-08 23:59:59', 'UTC') AS date_to,
|
||||
toDateTime('2021-01-01 00:00:00', 'UTC') AS date_from,
|
||||
2 AS target_step,
|
||||
['$pageview', 'insight analyzed'] as funnel_step_names
|
||||
SELECT actors.actor_id AS actor_id ,
|
||||
any(actors.matching_events) AS matching_events
|
||||
FROM events AS event
|
||||
@@ -141,7 +141,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_funnel_correlation_on_event_with_recordings.1
|
||||
'
|
||||
|
||||
/* request:1 */
|
||||
SELECT DISTINCT session_id
|
||||
FROM session_recording_events
|
||||
WHERE team_id = 2
|
||||
@@ -151,7 +151,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_funnel_correlation_on_event_with_recordings.2
|
||||
'
|
||||
WITH funnel_actors as
|
||||
/* request:1 */ WITH funnel_actors as
|
||||
(SELECT aggregation_target AS actor_id,
|
||||
final_matching_events as matching_events,
|
||||
timestamp,
|
||||
@@ -333,10 +333,10 @@
|
||||
HAVING steps = max_steps SETTINGS allow_experimental_window_functions = 1)
|
||||
WHERE steps IN [1, 2, 3]
|
||||
ORDER BY aggregation_target SETTINGS allow_experimental_window_functions = 1),
|
||||
toDateTime('2021-01-08 23:59:59', 'UTC') AS date_to,
|
||||
toDateTime('2021-01-01 00:00:00', 'UTC') AS date_from,
|
||||
3 AS target_step,
|
||||
['$pageview', 'insight analyzed', 'insight updated'] as funnel_step_names
|
||||
toDateTime('2021-01-08 23:59:59', 'UTC') AS date_to,
|
||||
toDateTime('2021-01-01 00:00:00', 'UTC') AS date_from,
|
||||
3 AS target_step,
|
||||
['$pageview', 'insight analyzed', 'insight updated'] as funnel_step_names
|
||||
SELECT actors.actor_id AS actor_id ,
|
||||
any(actors.matching_events) AS matching_events
|
||||
FROM events AS event
|
||||
@@ -364,7 +364,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_funnel_correlation_on_event_with_recordings.3
|
||||
'
|
||||
|
||||
/* request:1 */
|
||||
SELECT DISTINCT session_id
|
||||
FROM session_recording_events
|
||||
WHERE team_id = 2
|
||||
@@ -374,7 +374,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_funnel_correlation_on_properties_with_recordings
|
||||
'
|
||||
WITH funnel_actors AS
|
||||
/* request:1 */ WITH funnel_actors AS
|
||||
(SELECT aggregation_target AS actor_id,
|
||||
final_matching_events as matching_events,
|
||||
timestamp,
|
||||
@@ -496,7 +496,7 @@
|
||||
HAVING steps = max_steps SETTINGS allow_experimental_window_functions = 1)
|
||||
WHERE steps IN [1, 2]
|
||||
ORDER BY aggregation_target SETTINGS allow_experimental_window_functions = 1),
|
||||
2 AS target_step
|
||||
2 AS target_step
|
||||
SELECT funnel_actors.actor_id AS actor_id ,
|
||||
any(funnel_actors.matching_events) AS matching_events
|
||||
FROM funnel_actors
|
||||
@@ -509,7 +509,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_funnel_correlation_on_properties_with_recordings.1
|
||||
'
|
||||
|
||||
/* request:1 */
|
||||
SELECT DISTINCT session_id
|
||||
FROM session_recording_events
|
||||
WHERE team_id = 2
|
||||
@@ -519,7 +519,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_strict_funnel_correlation_with_recordings
|
||||
'
|
||||
WITH funnel_actors AS
|
||||
/* request:1 */ WITH funnel_actors AS
|
||||
(SELECT aggregation_target AS actor_id,
|
||||
final_matching_events as matching_events,
|
||||
timestamp,
|
||||
@@ -639,7 +639,7 @@
|
||||
HAVING steps = max_steps)
|
||||
WHERE steps IN [1, 2]
|
||||
ORDER BY aggregation_target SETTINGS allow_experimental_window_functions = 1),
|
||||
2 AS target_step
|
||||
2 AS target_step
|
||||
SELECT funnel_actors.actor_id AS actor_id ,
|
||||
any(funnel_actors.matching_events) AS matching_events
|
||||
FROM funnel_actors
|
||||
@@ -652,7 +652,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_strict_funnel_correlation_with_recordings.1
|
||||
'
|
||||
|
||||
/* request:1 */
|
||||
SELECT DISTINCT session_id
|
||||
FROM session_recording_events
|
||||
WHERE team_id = 2
|
||||
@@ -662,7 +662,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_strict_funnel_correlation_with_recordings.2
|
||||
'
|
||||
WITH funnel_actors AS
|
||||
/* request:1 */ WITH funnel_actors AS
|
||||
(SELECT aggregation_target AS actor_id,
|
||||
final_matching_events as matching_events,
|
||||
timestamp,
|
||||
@@ -782,7 +782,7 @@
|
||||
HAVING steps = max_steps)
|
||||
WHERE steps IN [1, 2]
|
||||
ORDER BY aggregation_target SETTINGS allow_experimental_window_functions = 1),
|
||||
2 AS target_step
|
||||
2 AS target_step
|
||||
SELECT funnel_actors.actor_id AS actor_id ,
|
||||
any(funnel_actors.matching_events) AS matching_events
|
||||
FROM funnel_actors
|
||||
@@ -795,7 +795,7 @@
|
||||
---
|
||||
# name: TestClickhouseFunnelCorrelationsActors.test_strict_funnel_correlation_with_recordings.3
|
||||
'
|
||||
|
||||
/* request:1 */
|
||||
SELECT DISTINCT session_id
|
||||
FROM session_recording_events
|
||||
WHERE team_id = 2
|
||||
|
||||
@@ -3,10 +3,10 @@ env =
|
||||
DEBUG=1
|
||||
TEST=1
|
||||
DJANGO_SETTINGS_MODULE = posthog.settings
|
||||
addopts = -p no:warnings --reuse-db
|
||||
addopts = -p no:warnings -p no:randomly --reuse-db
|
||||
|
||||
markers =
|
||||
ee
|
||||
clickhouse_only
|
||||
skip_on_multitenancy
|
||||
async_migrations
|
||||
async_migrations
|
||||
|
||||
@@ -41,6 +41,7 @@ pytest-env==0.6.2
|
||||
pytest-icdiff==0.5
|
||||
pytest-mock==3.5.1
|
||||
pytest-cov==2.12.1
|
||||
pytest-randomly==3.12.0
|
||||
pytest-split==0.6.0
|
||||
pytest-watch==4.2.0
|
||||
syrupy==1.4.6
|
||||
|
||||
@@ -103,6 +103,10 @@ idna==2.8
|
||||
# -c requirements.txt
|
||||
# requests
|
||||
# urllib3
|
||||
importlib-metadata==5.0.0
|
||||
# via
|
||||
# -c requirements.txt
|
||||
# pytest-randomly
|
||||
iniconfig==1.1.1
|
||||
# via pytest
|
||||
isort==5.2.2
|
||||
@@ -177,6 +181,7 @@ pytest==6.2.2
|
||||
# pytest-env
|
||||
# pytest-icdiff
|
||||
# pytest-mock
|
||||
# pytest-randomly
|
||||
# pytest-split
|
||||
# pytest-watch
|
||||
# syrupy
|
||||
@@ -190,6 +195,8 @@ pytest-icdiff==0.5
|
||||
# via -r requirements-dev.in
|
||||
pytest-mock==3.5.1
|
||||
# via -r requirements-dev.in
|
||||
pytest-randomly==3.12.0
|
||||
# via -r requirements-dev.in
|
||||
pytest-split==0.6.0
|
||||
# via -r requirements-dev.in
|
||||
pytest-watch==4.2.0
|
||||
@@ -272,6 +279,10 @@ wrapt==1.14.1
|
||||
# via
|
||||
# -c requirements.txt
|
||||
# deprecated
|
||||
zipp==3.1.0
|
||||
# via
|
||||
# -c requirements.txt
|
||||
# importlib-metadata
|
||||
|
||||
# The following packages are considered to be unsafe in a requirements file:
|
||||
# pip
|
||||
|
||||
@@ -37,7 +37,7 @@ geoip2==4.6.0
|
||||
google-cloud-sqlcommenter==2.0.0
|
||||
gunicorn==20.1.0
|
||||
idna==2.8
|
||||
importlib-metadata==1.6.0
|
||||
importlib-metadata==5.0.0
|
||||
infi-clickhouse-orm@ git+https://github.com/PostHog/infi.clickhouse_orm@37722f350f3b449bbcd6564917c436b0d93e796f
|
||||
kafka-python==2.0.2
|
||||
kafka-helper==0.2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# This file is autogenerated by pip-compile with python 3.9
|
||||
# This file is autogenerated by pip-compile with python 3.8
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile requirements.in
|
||||
@@ -166,8 +166,10 @@ idna==2.8
|
||||
# trio
|
||||
# urllib3
|
||||
# yarl
|
||||
importlib-metadata==1.6.0
|
||||
importlib-metadata==5.0.0
|
||||
# via -r requirements.in
|
||||
importlib-resources==5.10.0
|
||||
# via jsonschema
|
||||
infi-clickhouse-orm @ git+https://github.com/PostHog/infi.clickhouse_orm@37722f350f3b449bbcd6564917c436b0d93e796f
|
||||
# via -r requirements.in
|
||||
inflection==0.5.1
|
||||
@@ -377,7 +379,9 @@ xmlsec==1.3.12
|
||||
yarl==1.7.2
|
||||
# via aiohttp
|
||||
zipp==3.1.0
|
||||
# via importlib-metadata
|
||||
# via
|
||||
# importlib-metadata
|
||||
# importlib-resources
|
||||
|
||||
# The following packages are considered to be unsafe in a requirements file:
|
||||
# setuptools
|
||||
|
||||
Reference in New Issue
Block a user