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

Bug report: Funnel breakdown by HogQL expression - query fails for Historical trends #22928

Closed
slshults opened this issue Jun 12, 2024 · 4 comments · Fixed by #23278 or #23307
Closed
Labels

Comments

@slshults
Copy link
Contributor

slshults commented Jun 12, 2024

Bug Description

Bug description

A HogQL expression (e.g. properties.detail.canvas_name) works in trends insight, and works in a funnel insight for graph type Conversion steps, but the query fails for Historical trends

Works on the Trends tab:
CleanShot 2024-06-12 at 12 01 42@2x

Works for Conversion steps in a funnel:
CleanShot 2024-06-12 at 12 05 19@2x

Error for Historical trends in the same funnel:
CleanShot 2024-06-12 at 12 04 57@2x

How to reproduce

  1. Edit this insight https://us.posthog.com/project/22502/insights/AoQJ3qOr
  2. Change the graph type to Historical trends
  3. See the sad

Additional context

From: https://posthoghelp.zendesk.com/agent/tickets/14569
https://posthoghelp.zendesk.com/agent/tickets/13847

Debug info

Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/01900dd3-fd5a-7a39-bcc6-30a6491e9b17?t=1278 
Admin: http://go/adminOrgUS/0186e81a-d60c-0000-c973-42780b53afa2 (Project: 22502)
Sentry: http://go/sentryUS/22502

Likely related Sentry issue

Sentry Issue: POSTHOG-1BNW

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
  File "django/db/models/fields/__init__.py", line 2053, in get_prep_value
    return int(value)

TypeError: Field 'id' expected a number but got [None].
(20 additional frame(s) were not displayed)
...
  File "posthog/api/services/query.py", line 50, in process_query_dict
    return process_query_model(
  File "posthog/api/services/query.py", line 143, in process_query_model
    result = query_runner.run(execution_mode=execution_mode, user=user, query_id=query_id)
  File "posthog/hogql_queries/query_runner.py", line 515, in run
    **self.calculate().model_dump(),
  File "posthog/hogql_queries/insights/funnels/funnels_query_runner.py", line 100, in calculate
    results = self.funnel_class._format_results(response.results)
  File "posthog/hogql_queries/insights/funnels/funnel_trends.py", line 82, in _format_results
    serialized_result.update({"breakdown_value": Cohort.objects.get(pk=period_row[-1]).name})
@webjunkie
Copy link
Contributor

Similar: Chart doesn't fail but query returns all 0 for historical trend:

https://posthoghelp.zendesk.com/agent/tickets/14202

@slshults
Copy link
Contributor Author

Alas, historical trends still aren't playing nice on https://us.posthog.com/project/22502/insights/Gg6b84Pq/edit :

CleanShot 2024-06-27 at 17 11 21@2x

@slshults slshults reopened this Jun 28, 2024
Copy link

sentry-io bot commented Jun 28, 2024

Sentry Issue: POSTHOG-1D9M

@webjunkie
Copy link
Contributor

webjunkie commented Jun 28, 2024

Now the query works... but it seems historical trends with breakdowns are broken in general in that they just display all zero.
Edit: This happens when the property is not present in all steps, it seems. Investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants