Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hogql cohort queries #27811

Merged
merged 86 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
e74d7e9
fix
aspicer Jan 23, 2025
142a77a
Update query snapshots
github-actions[bot] Jan 23, 2025
c929951
Update query snapshots
github-actions[bot] Jan 23, 2025
ade0fa1
event query for multiple
aspicer Jan 23, 2025
ab672b7
Merge branch 'aspicer/cohort_hogql_fixes' of github.com:PostHog/posth…
aspicer Jan 23, 2025
64a2594
hm
aspicer Jan 24, 2025
2f0c7a8
fix
aspicer Jan 23, 2025
996ad3e
event query for multiple
aspicer Jan 23, 2025
064bc6b
Update query snapshots
github-actions[bot] Jan 23, 2025
74dd179
Update query snapshots
github-actions[bot] Jan 23, 2025
5014409
hm
aspicer Jan 24, 2025
6ac2a98
Merge branch 'aspicer/cohort_hogql_fixes' of github.com:PostHog/posth…
aspicer Jan 28, 2025
231e6ed
Update query snapshots
github-actions[bot] Jan 28, 2025
611e78e
Update query snapshots
github-actions[bot] Jan 28, 2025
fd5d1f5
added test for limit
aspicer Jan 29, 2025
2771ac1
fix limit
aspicer Jan 29, 2025
9ea9a41
Merge branch 'aspicer/cohort_hogql_fixes' of github.com:PostHog/posth…
aspicer Jan 29, 2025
2076749
Update query snapshots
github-actions[bot] Jan 29, 2025
698e939
Update query snapshots
github-actions[bot] Jan 29, 2025
fc6a1fd
Update query snapshots
github-actions[bot] Jan 29, 2025
7f8a81d
Merge remote-tracking branch 'origin/master' into aspicer/cohort_hogq…
aspicer Jan 30, 2025
ee59fd7
Merge branch 'aspicer/cohort_hogql_fixes' of github.com:PostHog/posth…
aspicer Jan 30, 2025
1b368a8
test failing
aspicer Feb 1, 2025
966cde1
cast
aspicer Feb 1, 2025
2859f52
Update query snapshots
github-actions[bot] Feb 1, 2025
2320108
fixing bugs
aspicer Feb 3, 2025
a1d09f8
Merge branch 'aspicer/cohort_hogql_fixes' of github.com:PostHog/posth…
aspicer Feb 3, 2025
7074507
merge
aspicer Feb 3, 2025
6460dd5
prevent overriding
aspicer Feb 3, 2025
a88cc80
nullable
aspicer Feb 3, 2025
c8746f4
kill dead code
aspicer Feb 3, 2025
880672c
Update query snapshots
github-actions[bot] Feb 3, 2025
ad17083
Update query snapshots
github-actions[bot] Feb 3, 2025
06ec759
Update query snapshots
github-actions[bot] Feb 3, 2025
a8def27
Merge remote-tracking branch 'origin/master' into aspicer/cohort_hogq…
aspicer Feb 4, 2025
ae94ce3
Merge remote-tracking branch 'origin/master' into aspicer/cohort_hogq…
aspicer Feb 4, 2025
f8ba705
test fixes
aspicer Feb 4, 2025
425fb8a
Update query snapshots
github-actions[bot] Feb 4, 2025
7ea6c3f
Merge remote-tracking branch 'origin/master' into aspicer/cohort_hogq…
aspicer Feb 4, 2025
df7ec5a
Merge branch 'aspicer/cohort_hogql_fixes' of github.com:PostHog/posth…
aspicer Feb 4, 2025
5369ade
newest reqs
aspicer Feb 4, 2025
fdb63d7
null properties
aspicer Feb 4, 2025
c389277
test file
aspicer Feb 4, 2025
83cbcb2
remove failing tesT
aspicer Feb 4, 2025
00a8501
Update query snapshots
github-actions[bot] Feb 4, 2025
7744250
Update query snapshots
github-actions[bot] Feb 4, 2025
e0f0af3
Update query snapshots
github-actions[bot] Feb 4, 2025
3dd8fb5
Update query snapshots
github-actions[bot] Feb 4, 2025
cf932b3
Update query snapshots
github-actions[bot] Feb 4, 2025
6fdf2c2
Merge remote-tracking branch 'origin/master' into aspicer/null_proper…
aspicer Feb 4, 2025
f41cc78
test fix
aspicer Feb 4, 2025
f0692d0
Merge
aspicer Feb 4, 2025
74dad29
Update query snapshots
github-actions[bot] Feb 4, 2025
29540fa
failing test
aspicer Feb 4, 2025
66afb1c
hm
aspicer Feb 5, 2025
0148f8f
clean up
aspicer Feb 5, 2025
fcd7df7
redo
aspicer Feb 5, 2025
749ff77
Merge branch 'aspicer/null_properties' into aspicer/cohort_hogql_fixes
aspicer Feb 5, 2025
3c83fd4
Update query snapshots
github-actions[bot] Feb 5, 2025
0b09ce0
node types
aspicer Feb 5, 2025
436485c
Merge branch 'aspicer/null_properties' of github.com:PostHog/posthog …
aspicer Feb 5, 2025
2a9f50e
Update query snapshots
github-actions[bot] Feb 5, 2025
e961618
oops
aspicer Feb 5, 2025
f28eb58
feature flag
aspicer Feb 5, 2025
5e61c0f
remove comment
aspicer Feb 5, 2025
03898f5
Update query snapshots
github-actions[bot] Feb 5, 2025
1ec537d
Update query snapshots
github-actions[bot] Feb 5, 2025
ee15c9b
Update query snapshots
github-actions[bot] Feb 5, 2025
2fd8805
Update query snapshots
github-actions[bot] Feb 5, 2025
6b84f89
Update query snapshots
github-actions[bot] Feb 5, 2025
7f239f0
fix typo
aspicer Feb 6, 2025
866471f
Merge branch 'aspicer/null_properties' into aspicer/cohort_hogql_fixes
aspicer Feb 6, 2025
48a410c
Update query snapshots
github-actions[bot] Feb 6, 2025
3a11cdb
Update query snapshots
github-actions[bot] Feb 6, 2025
8111c28
merge
aspicer Feb 13, 2025
a9b8f8a
merge
aspicer Feb 13, 2025
55a14a4
Update query snapshots
github-actions[bot] Feb 13, 2025
d8e63c9
tests
aspicer Feb 13, 2025
b1c27e2
Update query snapshots
github-actions[bot] Feb 13, 2025
24f029a
fix last test
aspicer Feb 13, 2025
05eb268
Merge branch 'aspicer/cohort_hogql_fixes' of github.com:PostHog/posth…
aspicer Feb 13, 2025
d8e8f0d
Merge remote-tracking branch 'origin/master' into aspicer/cohort_hogq…
aspicer Feb 19, 2025
47ac17d
hm
aspicer Feb 19, 2025
40cb63e
coalesce
aspicer Feb 19, 2025
cc611fd
change
aspicer Feb 19, 2025
2bf4664
mypy
aspicer Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions ee/clickhouse/models/test/__snapshots__/test_cohort.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons
WHERE ifNull(equals(persons.`properties___$some_prop`, 'something'), 0)
ORDER BY persons.id ASC
LIMIT 100 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto')) INTERSECT (
(SELECT persons.id AS id
FROM
(SELECT argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$another_prop'), ''), 'null'), '^"|"$', ''), person.version) AS `properties___$another_prop`,
person.id AS id
FROM person
WHERE and(equals(person.team_id, 99999), in(id,
(SELECT where_optimization.id AS id
FROM person AS where_optimization
WHERE and(equals(where_optimization.team_id, 99999), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(where_optimization.properties, '$another_prop'), ''), 'null'), '^"|"$', ''), 'something'), 0)))))
GROUP BY person.id
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons
WHERE ifNull(equals(persons.`properties___$another_prop`, 'something'), 0)
ORDER BY persons.id ASC
LIMIT 100 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto')))) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto')) INTERSECT (
(SELECT persons.id AS id
FROM
(SELECT argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$another_prop'), ''), 'null'), '^"|"$', ''), person.version) AS `properties___$another_prop`,
person.id AS id
FROM person
WHERE and(equals(person.team_id, 99999), in(id,
(SELECT where_optimization.id AS id
FROM person AS where_optimization
WHERE and(equals(where_optimization.team_id, 99999), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(where_optimization.properties, '$another_prop'), ''), 'null'), '^"|"$', ''), 'something'), 0)))))
GROUP BY person.id
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons
WHERE ifNull(equals(persons.`properties___$another_prop`, 'something'), 0)
ORDER BY persons.id ASC
LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto')))) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
'''
# ---
# name: TestCohort.test_cohortpeople_with_not_in_cohort_operator
Expand Down Expand Up @@ -137,9 +137,9 @@
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons
WHERE ifNull(equals(persons.`properties___$some_prop`, 'something1'), 0)
ORDER BY persons.id ASC
LIMIT 100 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto')) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto')) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
'''
# ---
# name: TestCohort.test_cohortpeople_with_not_in_cohort_operator.2
Expand Down Expand Up @@ -236,8 +236,8 @@
WHERE and(equals(e.team_id, 99999), greaterOrEquals(timestamp, toDateTime64('explicit_redacted_timestamp.000000', 6, 'UTC')), lessOrEquals(timestamp, toDateTime64('explicit_redacted_timestamp.999999', 6, 'UTC')), equals(e.event, '$pageview')))
GROUP BY actor_id) AS source
ORDER BY source.id ASC
LIMIT 100 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto'))
LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto'))
EXCEPT (((
(SELECT persons.id AS id
FROM
Expand All @@ -252,9 +252,9 @@
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))) AS persons
WHERE ifNull(equals(persons.`properties___$some_prop`, 'something1'), 0)
ORDER BY persons.id ASC
LIMIT 100 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto'))))) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto'))))) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
'''
# ---
# name: TestCohort.test_cohortpeople_with_not_in_cohort_operator_and_no_precalculation
Expand Down Expand Up @@ -393,9 +393,9 @@
or isNotNull(fromUnixTimestamp(0)))))
GROUP BY actor_id) AS source
ORDER BY source.id ASC
LIMIT 100 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto')) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto')) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
'''
# ---
# name: TestCohort.test_cohortpeople_with_not_in_cohort_operator_for_behavioural_cohorts.2
Expand Down Expand Up @@ -478,8 +478,8 @@
WHERE and(equals(e.team_id, 99999), greaterOrEquals(timestamp, toDateTime64('explicit_redacted_timestamp.000000', 6, 'UTC')), lessOrEquals(timestamp, toDateTime64('explicit_redacted_timestamp.999999', 6, 'UTC')), equals(e.event, '$pageview')))
GROUP BY actor_id) AS source
ORDER BY source.id ASC
LIMIT 100 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto'))
LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto'))
EXCEPT (((
(SELECT source.id AS id
FROM
Expand Down Expand Up @@ -508,9 +508,9 @@
or isNotNull(fromUnixTimestamp(0)))))
GROUP BY actor_id) AS source
ORDER BY source.id ASC
LIMIT 100 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto'))))) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
LIMIT 1000000000 SETTINGS optimize_aggregation_in_order=1,
join_algorithm='auto'))))) as person SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
'''
# ---
# name: TestCohort.test_static_cohort_precalculated
Expand Down
Loading
Loading