Skip to content

Commit

Permalink
feat(trends): use hogql for legacy insight trends api (#27213)
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr authored Jan 13, 2025
1 parent 69893a1 commit 1720839
Show file tree
Hide file tree
Showing 15 changed files with 1,105 additions and 1,420 deletions.
562 changes: 343 additions & 219 deletions ee/clickhouse/views/test/__snapshots__/test_clickhouse_stickiness.ambr

Large diffs are not rendered by default.

719 changes: 394 additions & 325 deletions ee/clickhouse/views/test/__snapshots__/test_clickhouse_trends.ambr

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def test_event_correlation_endpoint_picks_up_events_for_odds_ratios(self):
],
"skewed": False,
},
"query_method": "hogql",
}

def test_event_correlation_is_partitioned_by_team(self):
Expand Down Expand Up @@ -217,6 +218,7 @@ def test_event_correlation_endpoint_does_not_include_historical_events(self):
"is_cached": False,
"last_refresh": "2020-01-01T00:00:00Z",
"result": {"events": [], "skewed": False},
"query_method": "hogql",
}

def test_event_correlation_endpoint_does_not_include_funnel_steps(self):
Expand Down Expand Up @@ -278,6 +280,7 @@ def test_event_correlation_endpoint_does_not_include_funnel_steps(self):
],
"skewed": False,
},
"query_method": "hogql",
}

def test_events_correlation_endpoint_provides_people_drill_down_urls(self):
Expand Down Expand Up @@ -597,6 +600,7 @@ def test_correlation_endpoint_request_with_no_steps_doesnt_fail(self):
"is_cached": False,
"last_refresh": "2020-01-01T00:00:00Z",
"result": {"events": [], "skewed": False},
"query_method": "hogql",
}

def test_funnel_correlation_with_event_properties_autocapture(self):
Expand Down Expand Up @@ -682,6 +686,7 @@ def test_funnel_correlation_with_event_properties_autocapture(self):
},
"last_refresh": "2020-01-01T00:00:00Z",
"is_cached": False,
"query_method": "hogql",
}

assert get_people_for_correlation_ok(client=self.client, correlation=response["result"]["events"][0]) == {
Expand Down
20 changes: 1 addition & 19 deletions ee/clickhouse/views/test/test_clickhouse_stickiness.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_filter_by_group_properties(self):
properties={},
)

p1, p2, p3, p4 = self._create_multiple_people(
self._create_multiple_people(
period=timedelta(weeks=1),
event_properties=lambda i: {
"$group_0": f"org:{i}",
Expand Down Expand Up @@ -112,15 +112,6 @@ def test_filter_by_group_properties(self):
assert data["watched movie"][2].value == 0
assert data["watched movie"][3].value == 1

with freeze_time("2020-02-15T13:01:01Z"):
week1_actors = get_people_from_url_ok(self.client, data["watched movie"][1].person_url)
week2_actors = get_people_from_url_ok(self.client, data["watched movie"][2].person_url)
week3_actors = get_people_from_url_ok(self.client, data["watched movie"][3].person_url)

assert sorted([p["id"] for p in week1_actors]) == sorted([str(p1.uuid)])
assert sorted([p["id"] for p in week2_actors]) == sorted([])
assert sorted([p["id"] for p in week3_actors]) == sorted([str(p3.uuid)])

@snapshot_clickhouse_queries
def test_aggregate_by_groups(self):
create_group(
Expand Down Expand Up @@ -169,15 +160,6 @@ def test_aggregate_by_groups(self):
assert data["watched movie"][2].value == 0
assert data["watched movie"][3].value == 1

with freeze_time("2020-02-15T13:01:01Z"):
week1_actors = get_people_from_url_ok(self.client, data["watched movie"][1].person_url)
week2_actors = get_people_from_url_ok(self.client, data["watched movie"][2].person_url)
week3_actors = get_people_from_url_ok(self.client, data["watched movie"][3].person_url)

assert sorted([p["id"] for p in week1_actors]) == sorted(["org:0", "org:2"])
assert sorted([p["id"] for p in week2_actors]) == sorted([])
assert sorted([p["id"] for p in week3_actors]) == sorted(["org:1"])

@snapshot_clickhouse_queries
def test_timezones(self):
journeys_for(
Expand Down
Loading

0 comments on commit 1720839

Please sign in to comment.