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 efe9aa9 commit b2d706d
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 @@ -14,12 +14,26 @@

-- HogQL

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, 1), 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
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, 1), 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
'''
# ---
Expand All @@ -38,12 +52,26 @@

-- HogQL

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, [2])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(1, equals(__in_cohort.matched, 1))
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, [2])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)

WHERE
and(1, equals(__in_cohort.matched, 1))

LIMIT 100
'''
# ---
Expand All @@ -62,12 +90,26 @@

-- HogQL

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, [3])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(1, equals(__in_cohort.matched, 1))
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, [3])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)

WHERE
and(1, equals(__in_cohort.matched, 1))

LIMIT 100
'''
# ---
Expand All @@ -88,14 +130,33 @@

-- HogQL

SELECT event
FROM events LEFT JOIN (
SELECT person_id, 1 AS matched
FROM raw_cohort_people
WHERE equals(cohort_id, 4)
GROUP BY person_id, cohort_id, version
HAVING greater(sum(sign), 0)) AS in_cohort__4 ON equals(in_cohort__4.person_id, person_id)
WHERE and(equals(in_cohort__4.matched, 1), equals(event, 'RANDOM_TEST_ID::UUID'))
SELECT
event

FROM
events
LEFT JOIN (
SELECT
person_id,
1 AS matched

FROM
raw_cohort_people

WHERE
equals(cohort_id, 4)

GROUP BY
person_id,
cohort_id,
version

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

WHERE
and(equals(in_cohort__4.matched, 1), equals(event, 'RANDOM_TEST_ID::UUID'))

LIMIT 100
'''
# ---
Expand All @@ -114,12 +175,25 @@

-- HogQL

SELECT event
FROM events LEFT JOIN (
SELECT person_id, 1 AS matched
FROM static_cohort_people
WHERE equals(cohort_id, 5)) AS in_cohort__5 ON equals(in_cohort__5.person_id, person_id)
WHERE equals(in_cohort__5.matched, 1)
SELECT
event

FROM
events
LEFT JOIN (
SELECT
person_id,
1 AS matched

FROM
static_cohort_people

WHERE
equals(cohort_id, 5)) AS in_cohort__5 ON equals(in_cohort__5.person_id, person_id)

WHERE
equals(in_cohort__5.matched, 1)

LIMIT 100
'''
# ---
Expand All @@ -138,12 +212,25 @@

-- HogQL

SELECT event
FROM events LEFT JOIN (
SELECT person_id, 1 AS matched
FROM static_cohort_people
WHERE equals(cohort_id, 6)) AS in_cohort__6 ON equals(in_cohort__6.person_id, person_id)
WHERE equals(in_cohort__6.matched, 1)
SELECT
event

FROM
events
LEFT JOIN (
SELECT
person_id,
1 AS matched

FROM
static_cohort_people

WHERE
equals(cohort_id, 6)) AS in_cohort__6 ON equals(in_cohort__6.person_id, person_id)

WHERE
equals(in_cohort__6.matched, 1)

LIMIT 100
'''
# ---

0 comments on commit b2d706d

Please sign in to comment.