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 Jan 25, 2024
1 parent fdc4f10 commit c08bb16
Showing 1 changed file with 125 additions and 38 deletions.
163 changes: 125 additions & 38 deletions posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
'''
-- ClickHouse

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, 1), 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))
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, 1), 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

Expand Down Expand Up @@ -41,12 +55,26 @@
'''
-- ClickHouse

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, [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))
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, [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

Expand Down Expand Up @@ -79,12 +107,26 @@
'''
-- ClickHouse

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, [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))
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, [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

Expand Down Expand Up @@ -117,14 +159,33 @@
'''
-- ClickHouse

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, 4))
GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version
HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)) AS in_cohort__4 ON equals(in_cohort__4.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__4.matched, 1), 0), equals(events.event, %(hogql_val_0)s))
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, 4))

GROUP BY
cohortpeople.person_id,
cohortpeople.cohort_id,
cohortpeople.version

HAVING
ifNull(greater(sum(cohortpeople.sign), 0), 0)) AS in_cohort__4 ON equals(in_cohort__4.person_id, events.person_id)

WHERE
and(equals(events.team_id, 420), ifNull(equals(in_cohort__4.matched, 1), 0), equals(events.event, %(hogql_val_0)s))

LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1

Expand Down Expand Up @@ -164,12 +225,25 @@
'''
-- ClickHouse

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, 5))) AS in_cohort__5 ON equals(in_cohort__5.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__5.matched, 1), 0))
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, 5))) AS in_cohort__5 ON equals(in_cohort__5.person_id, events.person_id)

WHERE
and(equals(events.team_id, 420), ifNull(equals(in_cohort__5.matched, 1), 0))

LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1

Expand Down Expand Up @@ -201,12 +275,25 @@
'''
-- ClickHouse

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, 6))) AS in_cohort__6 ON equals(in_cohort__6.person_id, events.person_id)
WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__6.matched, 1), 0))
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, 6))) AS in_cohort__6 ON equals(in_cohort__6.person_id, events.person_id)

WHERE
and(equals(events.team_id, 420), ifNull(equals(in_cohort__6.matched, 1), 0))

LIMIT 100
SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1

Expand Down

0 comments on commit c08bb16

Please sign in to comment.