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(trends): use the bespoke other and null value in trends breakdowns #19620

Merged
merged 4 commits into from
Jan 5, 2024

Conversation

Gilbert09
Copy link
Member

Problem

  • In legacy trends, we added a special "other" and "null" value to show these extra categories in the UI correctly
  • Example PR of legacy: feat(insights): hide "other" breakdown #19359
  • This wasn't added to the HogQL version of trends

Changes

  • Adds the above values in place of None in the code, allowing for the Other breakdown to work as expected with strings, ints, and floats

How did you test this code?

  • Updated unit tests

@Gilbert09 Gilbert09 requested review from mariusandra and a team January 5, 2024 13:15
@Gilbert09 Gilbert09 changed the title Use the bespoke other and null value in trends breakdowns feat(trends): use the bespoke other and null value in trends breakdowns Jan 5, 2024
@posthog-bot
Copy link
Contributor

Hey @Gilbert09! 👋
This pull request seems to contain no description. Please add useful context, rationale, and/or any other information that will help make sense of this change now and in the distant Mars-based future.

@@ -4745,7 +4753,7 @@ def test_breakdown_filtering(self):
self.team,
)

self.assertEqual(response[0]["label"], "sign up - none")
self.assertEqual(response[0]["label"], "sign up - $$_posthog_breakdown_other_$$")
self.assertEqual(response[1]["label"], "sign up - value")
self.assertEqual(response[2]["label"], "sign up - other_value")
self.assertEqual(response[3]["label"], "no events - none")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to stay as none. Because there's no events, there are no breakdown values, and therefore we don't know the type of the values, therefore we dont know which version of the "other" value to use. Using the wrong one causes a clickhouse error with mismatched types with no supertype

Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks about right 👍

It seems that one test is legit failing though.

@Gilbert09 Gilbert09 merged commit cc677c5 into master Jan 5, 2024
92 checks passed
@Gilbert09 Gilbert09 deleted the tom/trends-other-null-value branch January 5, 2024 16:11
Copy link

sentry-io bot commented Jan 9, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: slice indices must be integers or None or have an index method /api/projects/{parent_lookup_team_id}/query/ View Issue
  • ‼️ TypeError: slice indices must be integers or None or have an index method /api/projects/{parent_lookup_team_id}/query/ View Issue

Did you find this useful? React with a 👍 or 👎

jacobwgillespie pushed a commit to jacobwgillespie/posthog that referenced this pull request Jan 12, 2024
…ns (PostHog#19620)

* Use the bespoke other and null value in trends breakdowns

* Fixed tests

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants