-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e0663f
commit 429302d
Showing
1 changed file
with
155 additions
and
0 deletions.
There are no files selected for viewing
155 changes: 155 additions & 0 deletions
155
ee/clickhouse/models/test/__snapshots__/test_property.ambr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# serializer version: 1 | ||
# name: TestPropFormat.test_parse_groups | ||
''' | ||
SELECT uuid | ||
FROM events | ||
WHERE team_id = 2 | ||
AND ((has(['val_1'], replaceRegexpAll(JSONExtractRaw(properties, 'attr_1'), '^"|"$', '')) | ||
AND has(['val_2'], replaceRegexpAll(JSONExtractRaw(properties, 'attr_2'), '^"|"$', ''))) | ||
OR (has(['val_2'], replaceRegexpAll(JSONExtractRaw(properties, 'attr_1'), '^"|"$', '')))) | ||
''' | ||
# --- | ||
# name: TestPropFormat.test_parse_groups_persons | ||
''' | ||
SELECT uuid | ||
FROM events | ||
WHERE team_id = 2 | ||
AND ((distinct_id IN | ||
(SELECT distinct_id | ||
FROM | ||
(SELECT distinct_id, | ||
argMax(person_id, version) as person_id | ||
FROM person_distinct_id2 | ||
WHERE team_id = 2 | ||
GROUP BY distinct_id | ||
HAVING argMax(is_deleted, version) = 0) | ||
WHERE person_id IN | ||
(SELECT id | ||
FROM | ||
(SELECT id, | ||
argMax(properties, person._timestamp) as properties, | ||
max(is_deleted) as is_deleted | ||
FROM person | ||
WHERE team_id = 2 | ||
GROUP BY id | ||
HAVING is_deleted = 0) | ||
WHERE has(['[email protected]'], replaceRegexpAll(JSONExtractRaw(properties, 'email'), '^"|"$', '')) ) )) | ||
OR (distinct_id IN | ||
(SELECT distinct_id | ||
FROM | ||
(SELECT distinct_id, | ||
argMax(person_id, version) as person_id | ||
FROM person_distinct_id2 | ||
WHERE team_id = 2 | ||
GROUP BY distinct_id | ||
HAVING argMax(is_deleted, version) = 0) | ||
WHERE person_id IN | ||
(SELECT id | ||
FROM | ||
(SELECT id, | ||
argMax(properties, person._timestamp) as properties, | ||
max(is_deleted) as is_deleted | ||
FROM person | ||
WHERE team_id = 2 | ||
GROUP BY id | ||
HAVING is_deleted = 0) | ||
WHERE has(['[email protected]'], replaceRegexpAll(JSONExtractRaw(properties, 'email'), '^"|"$', '')) ) ))) | ||
''' | ||
# --- | ||
# name: test_parse_groups_persons_edge_case_with_single_filter | ||
tuple( | ||
'AND ( has(%(vglobalperson_0)s, "pmat_email"))', | ||
dict({ | ||
'kglobalperson_0': 'email', | ||
'vglobalperson_0': list([ | ||
'[email protected]', | ||
]), | ||
}), | ||
) | ||
# --- | ||
# name: test_parse_prop_clauses_defaults | ||
tuple( | ||
''' | ||
AND ( has(%(vglobal_0)s, replaceRegexpAll(JSONExtractRaw(properties, %(kglobal_0)s), '^"|"$', '')) AND distinct_id IN ( | ||
SELECT distinct_id | ||
FROM ( | ||
|
||
SELECT distinct_id, argMax(person_id, version) as person_id | ||
FROM person_distinct_id2 | ||
WHERE team_id = %(team_id)s | ||
|
||
GROUP BY distinct_id | ||
HAVING argMax(is_deleted, version) = 0 | ||
|
||
) | ||
WHERE person_id IN | ||
( | ||
SELECT id | ||
FROM ( | ||
SELECT id, argMax(properties, person._timestamp) as properties, max(is_deleted) as is_deleted | ||
FROM person | ||
WHERE team_id = %(team_id)s | ||
GROUP BY id | ||
HAVING is_deleted = 0 | ||
) | ||
WHERE replaceRegexpAll(JSONExtractRaw(properties, %(kglobalperson_1)s), '^"|"$', '') ILIKE %(vglobalperson_1)s | ||
) | ||
)) | ||
''', | ||
dict({ | ||
'kglobal_0': 'event_prop', | ||
'kglobalperson_1': 'email', | ||
'vglobal_0': list([ | ||
'value', | ||
]), | ||
'vglobalperson_1': '%posthog%', | ||
}), | ||
) | ||
# --- | ||
# name: test_parse_prop_clauses_defaults.1 | ||
tuple( | ||
'AND ( has(%(vglobal_0)s, replaceRegexpAll(JSONExtractRaw(properties, %(kglobal_0)s), \'^"|"$\', \'\')) AND replaceRegexpAll(JSONExtractRaw(person_props, %(kglobalperson_1)s), \'^"|"$\', \'\') ILIKE %(vglobalperson_1)s)', | ||
dict({ | ||
'kglobal_0': 'event_prop', | ||
'kglobalperson_1': 'email', | ||
'vglobal_0': list([ | ||
'value', | ||
]), | ||
'vglobalperson_1': '%posthog%', | ||
}), | ||
) | ||
# --- | ||
# name: test_parse_prop_clauses_defaults.2 | ||
tuple( | ||
'AND ( has(%(vglobal_0)s, replaceRegexpAll(JSONExtractRaw(properties, %(kglobal_0)s), \'^"|"$\', \'\')) AND argMax(person."pmat_email", version) ILIKE %(vpersonquery_global_1)s)', | ||
dict({ | ||
'kglobal_0': 'event_prop', | ||
'kpersonquery_global_1': 'email', | ||
'vglobal_0': list([ | ||
'value', | ||
]), | ||
'vpersonquery_global_1': '%posthog%', | ||
}), | ||
) | ||
# --- | ||
# name: test_parse_prop_clauses_funnel_step_element_prepend_regression | ||
tuple( | ||
'AND ( (match(elements_chain, %(PREPEND__text_0_attributes_regex)s)))', | ||
dict({ | ||
'PREPEND__text_0_attributes_regex': '(text="Insights1")', | ||
}), | ||
) | ||
# --- | ||
# name: test_parse_prop_clauses_precalculated_cohort | ||
tuple( | ||
''' | ||
AND ( pdi.person_id IN ( | ||
SELECT DISTINCT person_id FROM cohortpeople WHERE team_id = %(team_id)s AND cohort_id = %(global_cohort_id_0)s AND version = %(global_version_0)s | ||
)) | ||
''', | ||
dict({ | ||
'global_cohort_id_0': 42, | ||
'global_version_0': None, | ||
}), | ||
) | ||
# --- |