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

feat(hogql): add funnel breakdowns #20153

Merged
merged 38 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f230a22
add breakdown tests
thmsobrmlr Feb 6, 2024
605707a
fix hogql printer for window partion by clause
thmsobrmlr Feb 6, 2024
e3fb65d
fix type in legacy funnel base
thmsobrmlr Feb 6, 2024
bf478c9
basic breakdown
thmsobrmlr Feb 6, 2024
d7df164
wip
thmsobrmlr Feb 6, 2024
65f95f3
convert more tests
thmsobrmlr Feb 6, 2024
66d561f
more tests
thmsobrmlr Feb 7, 2024
c40cefe
Update query snapshots
github-actions[bot] Feb 7, 2024
70d79ce
Update query snapshots
github-actions[bot] Feb 7, 2024
f03acb2
sort results
thmsobrmlr Feb 7, 2024
db8cb4c
more tests
thmsobrmlr Feb 7, 2024
d9065d7
more tests
thmsobrmlr Feb 7, 2024
d026cac
fixes
thmsobrmlr Feb 7, 2024
11ddeb5
fix breakdown property
thmsobrmlr Feb 7, 2024
c158172
wip
thmsobrmlr Feb 7, 2024
39d9efe
fix breakdown limit
thmsobrmlr Feb 7, 2024
23cd116
cleanup
thmsobrmlr Feb 7, 2024
4423c94
wip
thmsobrmlr Feb 8, 2024
6b0a23d
Merge branch 'master' into funnel-breakdowns
thmsobrmlr Feb 8, 2024
85d4c4e
Update query snapshots
github-actions[bot] Feb 8, 2024
1a0112b
calculate cohort people in test
thmsobrmlr Feb 9, 2024
ecd443a
fix cohort queries
thmsobrmlr Feb 9, 2024
325b7d5
adapt test to two series
thmsobrmlr Feb 9, 2024
c4f9a37
adapt breakdown tests to accept other funnel orders
thmsobrmlr Feb 9, 2024
5b085bb
wip
thmsobrmlr Feb 9, 2024
e91432f
add step filter
thmsobrmlr Feb 9, 2024
0f289be
fix hogql breakdown
thmsobrmlr Feb 9, 2024
54bdcd4
fixes
thmsobrmlr Feb 9, 2024
b5992f0
fix query snapshots
thmsobrmlr Feb 12, 2024
f32325c
Update query snapshots
github-actions[bot] Feb 12, 2024
95a22af
Merge branch 'master' into funnel-breakdowns
thmsobrmlr Feb 12, 2024
e98068d
Update query snapshots
github-actions[bot] Feb 12, 2024
bd89ea5
Update query snapshots
github-actions[bot] Feb 12, 2024
2523573
add ee tests
thmsobrmlr Feb 12, 2024
068f5c4
fix groups
thmsobrmlr Feb 12, 2024
07c8b2a
Update query snapshots
github-actions[bot] Feb 12, 2024
4825eff
Merge branch 'master' into funnel-breakdowns
thmsobrmlr Feb 12, 2024
0a5a1e6
Update query snapshots
github-actions[bot] Feb 12, 2024
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
4 changes: 3 additions & 1 deletion posthog/hogql/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,8 +1075,10 @@ def visit_window_expr(self, node: ast.WindowExpr):
if len(node.partition_by) == 0:
raise HogQLException("PARTITION BY must have at least one argument")
strings.append("PARTITION BY")
columns = []
for expr in node.partition_by:
strings.append(self.visit(expr))
columns.append(self.visit(expr))
strings.append(", ".join(columns))

if node.order_by is not None:
if len(node.order_by) == 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
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(person_static_cohort.team_id, 420), in(person_static_cohort.cohort_id, [16]))) 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 All @@ -42,7 +42,7 @@
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 in(cohort_id, [16])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(1, equals(__in_cohort.matched, 1))
LIMIT 100
'''
Expand All @@ -55,7 +55,7 @@
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(person_static_cohort.team_id, 420), in(person_static_cohort.cohort_id, [17]))) 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 All @@ -66,7 +66,7 @@
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 in(cohort_id, [17])) AS __in_cohort ON equals(__in_cohort.cohort_person_id, person_id)
WHERE and(1, equals(__in_cohort.matched, 1))
LIMIT 100
'''
Expand Down
Loading
Loading