Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech committed Oct 11, 2024
2 parents a46ec55 + d25f6af commit 57da9aa
Show file tree
Hide file tree
Showing 10 changed files with 4,653 additions and 261 deletions.
188 changes: 94 additions & 94 deletions posthog/api/test/__snapshots__/test_api_docs.ambr

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions posthog/api/test/__snapshots__/test_cohort.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
cohort_id
FROM cohortpeople
WHERE (team_id = 2
AND cohort_id = '378'
AND cohort_id = '1'
AND version < '2')
'''
# ---
Expand Down Expand Up @@ -177,7 +177,7 @@
cohort_id
FROM cohortpeople
WHERE (team_id = 2
AND cohort_id = '378'
AND cohort_id = '1'
AND version < '2')
'''
# ---
Expand All @@ -187,7 +187,7 @@
DELETE
FROM cohortpeople
WHERE (team_id = 2
AND cohort_id = '378'
AND cohort_id = '1'
AND version < '2')
'''
# ---
176 changes: 88 additions & 88 deletions posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -2,148 +2,148 @@
# name: TestInCohort.test_in_cohort_conjoined_dynamic
'''
-- ClickHouse
SELECT events.event AS event

SELECT events.event AS event
FROM events LEFT JOIN (
SELECT cohortpeople.person_id AS cohort_person_id, 1 AS matched, cohortpeople.cohort_id AS cohort_id
FROM cohortpeople
WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, XX), equals(cohortpeople.version, 0))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, events.person_id)
WHERE and(equals(events.team_id, 420), and(1, equals(events.event, %(hogql_val_0)s)), ifNull(equals(__in_cohort.matched, 1), 0))
LIMIT 100
SELECT cohortpeople.person_id AS cohort_person_id, 1 AS matched, cohortpeople.cohort_id AS cohort_id
FROM cohortpeople
WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, XX), equals(cohortpeople.version, 0))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, events.person_id)
WHERE and(equals(events.team_id, 420), and(1, equals(events.event, %(hogql_val_0)s)), ifNull(equals(__in_cohort.matched, 1), 0))
LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1, format_csv_allow_double_quotes=0, max_ast_elements=4000000, max_expanded_ast_elements=4000000, max_bytes_before_external_group_by=0

-- HogQL
SELECT event

SELECT event
FROM events LEFT JOIN (
SELECT person_id AS cohort_person_id, 1 AS matched, cohort_id
FROM raw_cohort_people
WHERE and(equals(cohort_id, XX), equals(version, 0))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(and(1, equals(event, 'RANDOM_TEST_ID::UUID')), equals(__in_cohort.matched, 1))
SELECT person_id AS cohort_person_id, 1 AS matched, cohort_id
FROM raw_cohort_people
WHERE and(equals(cohort_id, XX), equals(version, 0))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(and(1, equals(event, 'RANDOM_TEST_ID::UUID')), equals(__in_cohort.matched, 1))
LIMIT 100
'''
# ---
# name: TestInCohort.test_in_cohort_conjoined_int
'''
-- ClickHouse
SELECT events.event AS event

SELECT events.event AS event
FROM events LEFT JOIN (
SELECT person_static_cohort.person_id AS cohort_person_id, 1 AS matched, person_static_cohort.cohort_id AS cohort_id
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), in(person_static_cohort.cohort_id, [516]))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, events.person_id)
WHERE and(equals(events.team_id, 420), 1, ifNull(equals(__in_cohort.matched, 1), 0))
LIMIT 100
SELECT person_static_cohort.person_id AS cohort_person_id, 1 AS matched, person_static_cohort.cohort_id AS cohort_id
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), in(person_static_cohort.cohort_id, [2]))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, events.person_id)
WHERE and(equals(events.team_id, 420), 1, ifNull(equals(__in_cohort.matched, 1), 0))
LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1, format_csv_allow_double_quotes=0, max_ast_elements=4000000, max_expanded_ast_elements=4000000, max_bytes_before_external_group_by=0

-- HogQL
SELECT event

SELECT event
FROM events LEFT JOIN (
SELECT person_id AS cohort_person_id, 1 AS matched, cohort_id
FROM static_cohort_people
WHERE in(cohort_id, [516])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(1, equals(__in_cohort.matched, 1))
SELECT person_id AS cohort_person_id, 1 AS matched, cohort_id
FROM static_cohort_people
WHERE in(cohort_id, [2])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(1, equals(__in_cohort.matched, 1))
LIMIT 100
'''
# ---
# name: TestInCohort.test_in_cohort_conjoined_string
'''
-- ClickHouse
SELECT events.event AS event

SELECT events.event AS event
FROM events LEFT JOIN (
SELECT person_static_cohort.person_id AS cohort_person_id, 1 AS matched, person_static_cohort.cohort_id AS cohort_id
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), in(person_static_cohort.cohort_id, [517]))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, events.person_id)
WHERE and(equals(events.team_id, 420), 1, ifNull(equals(__in_cohort.matched, 1), 0))
LIMIT 100
SELECT person_static_cohort.person_id AS cohort_person_id, 1 AS matched, person_static_cohort.cohort_id AS cohort_id
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), in(person_static_cohort.cohort_id, [3]))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, events.person_id)
WHERE and(equals(events.team_id, 420), 1, ifNull(equals(__in_cohort.matched, 1), 0))
LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1, format_csv_allow_double_quotes=0, max_ast_elements=4000000, max_expanded_ast_elements=4000000, max_bytes_before_external_group_by=0

-- HogQL
SELECT event

SELECT event
FROM events LEFT JOIN (
SELECT person_id AS cohort_person_id, 1 AS matched, cohort_id
FROM static_cohort_people
WHERE in(cohort_id, [517])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(1, equals(__in_cohort.matched, 1))
SELECT person_id AS cohort_person_id, 1 AS matched, cohort_id
FROM static_cohort_people
WHERE in(cohort_id, [3])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(1, equals(__in_cohort.matched, 1))
LIMIT 100
'''
# ---
# name: TestInCohort.test_in_cohort_dynamic
'''
-- ClickHouse
SELECT events.event AS event

SELECT events.event AS event
FROM events LEFT JOIN (
SELECT cohortpeople.person_id AS person_id, 1 AS matched
FROM cohortpeople
WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, XX))
GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version
HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)) AS in_cohort__XX ON equals(in_cohort__XX.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__XX.matched, 1), 0), equals(events.event, %(hogql_val_0)s))
LIMIT 100
SELECT cohortpeople.person_id AS person_id, 1 AS matched
FROM cohortpeople
WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, XX))
GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version
HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)) AS in_cohort__XX ON equals(in_cohort__XX.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__XX.matched, 1), 0), equals(events.event, %(hogql_val_0)s))
LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1, format_csv_allow_double_quotes=0, max_ast_elements=4000000, max_expanded_ast_elements=4000000, max_bytes_before_external_group_by=0

-- HogQL
SELECT event

SELECT event
FROM events LEFT JOIN (
SELECT person_id, 1 AS matched
FROM raw_cohort_people
WHERE equals(cohort_id, XX)
GROUP BY person_id, cohort_id, version
HAVING greater(sum(sign), 0)) AS in_cohort__XX ON equals(in_cohort__XX.person_id, person_id)
WHERE and(equals(in_cohort__XX.matched, 1), equals(event, 'RANDOM_TEST_ID::UUID'))
SELECT person_id, 1 AS matched
FROM raw_cohort_people
WHERE equals(cohort_id, XX)
GROUP BY person_id, cohort_id, version
HAVING greater(sum(sign), 0)) AS in_cohort__XX ON equals(in_cohort__XX.person_id, person_id)
WHERE and(equals(in_cohort__XX.matched, 1), equals(event, 'RANDOM_TEST_ID::UUID'))
LIMIT 100
'''
# ---
# name: TestInCohort.test_in_cohort_static
'''
-- ClickHouse
SELECT events.event AS event

SELECT events.event AS event
FROM events LEFT JOIN (
SELECT person_static_cohort.person_id AS person_id, 1 AS matched
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, XX))) AS in_cohort__XX ON equals(in_cohort__XX.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__XX.matched, 1), 0))
LIMIT 100
SELECT person_static_cohort.person_id AS person_id, 1 AS matched
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, XX))) AS in_cohort__XX ON equals(in_cohort__XX.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__XX.matched, 1), 0))
LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1, format_csv_allow_double_quotes=0, max_ast_elements=4000000, max_expanded_ast_elements=4000000, max_bytes_before_external_group_by=0

-- HogQL
SELECT event

SELECT event
FROM events LEFT JOIN (
SELECT person_id, 1 AS matched
FROM static_cohort_people
WHERE equals(cohort_id, XX)) AS in_cohort__XX ON equals(in_cohort__XX.person_id, person_id)
WHERE equals(in_cohort__XX.matched, 1)
SELECT person_id, 1 AS matched
FROM static_cohort_people
WHERE equals(cohort_id, XX)) AS in_cohort__XX ON equals(in_cohort__XX.person_id, person_id)
WHERE equals(in_cohort__XX.matched, 1)
LIMIT 100
'''
# ---
# name: TestInCohort.test_in_cohort_strings
'''
-- ClickHouse
SELECT events.event AS event

SELECT events.event AS event
FROM events LEFT JOIN (
SELECT person_static_cohort.person_id AS person_id, 1 AS matched
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, XX))) AS in_cohort__XX ON equals(in_cohort__XX.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__XX.matched, 1), 0))
LIMIT 100
SELECT person_static_cohort.person_id AS person_id, 1 AS matched
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, XX))) AS in_cohort__XX ON equals(in_cohort__XX.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__XX.matched, 1), 0))
LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1, format_csv_allow_double_quotes=0, max_ast_elements=4000000, max_expanded_ast_elements=4000000, max_bytes_before_external_group_by=0

-- HogQL
SELECT event

SELECT event
FROM events LEFT JOIN (
SELECT person_id, 1 AS matched
FROM static_cohort_people
WHERE equals(cohort_id, XX)) AS in_cohort__XX ON equals(in_cohort__XX.person_id, person_id)
WHERE equals(in_cohort__XX.matched, 1)
SELECT person_id, 1 AS matched
FROM static_cohort_people
WHERE equals(cohort_id, XX)) AS in_cohort__XX ON equals(in_cohort__XX.person_id, person_id)
WHERE equals(in_cohort__XX.matched, 1)
LIMIT 100
'''
# ---
Loading

0 comments on commit 57da9aa

Please sign in to comment.