From dc98a00bf5d9c45e20f7ae3b6c717f39bab04559 Mon Sep 17 00:00:00 2001 From: Abhishek Mehandiratta <36722596+abhi12299@users.noreply.github.com> Date: Fri, 4 Oct 2024 01:03:39 +0530 Subject: [PATCH] fix(dashboard): remove breakdown limit in `apply_dashboard_filters` (#25265) Co-authored-by: Michael Matloka Co-authored-by: Michael Matloka --- .github/workflows/ci-backend.yml | 6 ------ .../trends/test/test_trends_dashboard_filters.py | 7 ++----- .../hogql_queries/insights/trends/trends_query_runner.py | 9 +-------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml index 56dae66425a..a3560ec5aea 100644 --- a/.github/workflows/ci-backend.yml +++ b/.github/workflows/ci-backend.yml @@ -147,12 +147,6 @@ jobs: run: | npm run schema:build:python && git diff --exit-code - - uses: actions/checkout@v4 - with: - repository: 'PostHog/posthog-cloud-infra' - path: 'posthog-cloud-infra' - token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }} - check-migrations: needs: changes if: needs.changes.outputs.backend == 'true' diff --git a/posthog/hogql_queries/insights/trends/test/test_trends_dashboard_filters.py b/posthog/hogql_queries/insights/trends/test/test_trends_dashboard_filters.py index 2443e0b4975..e3513b4654a 100644 --- a/posthog/hogql_queries/insights/trends/test/test_trends_dashboard_filters.py +++ b/posthog/hogql_queries/insights/trends/test/test_trends_dashboard_filters.py @@ -262,7 +262,7 @@ class TestTrendsDashboardFilters(BaseTest): assert query_runner.query.breakdownFilter is None assert query_runner.query.trendsFilter is None - def test_breakdown_limit_is_removed_when_too_large_for_dashboard(self): + def test_breakdown_limit_is_not_removed_for_dashboard(self): query_runner = self._create_query_runner( "2020-01-09", "2020-01-20", @@ -290,10 +290,7 @@ class TestTrendsDashboardFilters(BaseTest): query_runner.apply_dashboard_filters(DashboardFilter()) - assert query_runner.query.breakdownFilter == BreakdownFilter( - breakdown="abc", - breakdown_limit=None, # 50 series would be too many on a dashboard, reverting to default - ) + assert query_runner.query.breakdownFilter == BreakdownFilter(breakdown="abc", breakdown_limit=50) def test_compare_is_removed_for_all_time_range(self): query_runner = self._create_query_runner( diff --git a/posthog/hogql_queries/insights/trends/trends_query_runner.py b/posthog/hogql_queries/insights/trends/trends_query_runner.py index defdfc8ad10..4d7e6ec6198 100644 --- a/posthog/hogql_queries/insights/trends/trends_query_runner.py +++ b/posthog/hogql_queries/insights/trends/trends_query_runner.py @@ -16,7 +16,7 @@ from posthog.caching.insights_api import ( ) from posthog.clickhouse import query_tagging from posthog.hogql import ast -from posthog.hogql.constants import BREAKDOWN_VALUES_LIMIT, MAX_SELECT_RETURNED_ROWS, LimitContext +from posthog.hogql.constants import MAX_SELECT_RETURNED_ROWS, LimitContext from posthog.hogql.printer import to_printed_hogql from posthog.hogql.query import execute_hogql_query from posthog.hogql.timings import HogQLTimings @@ -979,13 +979,6 @@ class TrendsQueryRunner(QueryRunner): def apply_dashboard_filters(self, dashboard_filter: DashboardFilter): super().apply_dashboard_filters(dashboard_filter=dashboard_filter) - if ( - self.query.breakdownFilter - and self.query.breakdownFilter.breakdown_limit - and self.query.breakdownFilter.breakdown_limit > BREAKDOWN_VALUES_LIMIT - ): - # Remove too high breakdown limit for display on the dashboard - self.query.breakdownFilter.breakdown_limit = None if ( self.query.compareFilter is not None