-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(insights): hide "other" breakdown #19359
Conversation
Size Change: 0 B Total Size: 2 MB ℹ️ View Unchanged
|
@@ -98,7 +98,6 @@ | |||
""" | |||
|
|||
TOP_ELEMENTS_ARRAY_OF_KEY_SQL = """ | |||
SELECT groupArray(value) FROM ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running through groupArray()
removes the rows where this field is None
. We however do want to know if None
is part of the returned fields or not.
) | ||
|
||
if filter.using_histogram: | ||
return response[0][0] | ||
else: | ||
return [row[0] for row in response] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two queries here: 1) integer histogram breakdown, 2) string top results breakdown.
The response of the second query changed in order to also return nulls. More on it below.
BREAKDOWN_NULL_STRING_LABEL = "$$_posthog_breakdown_null_$$" | ||
BREAKDOWN_NULL_NUMERIC_LABEL = 9007199254740990 # pow(2, 53) - 2, for JS compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a giant fan of magic strings, but for now I consider this to be good enough... Or at least "helps us today and doesn't block us from adding a proper fix in the future".
Finally ready for a review |
Tried to test this, but no matter what I do, I don't get the "for readability, not all breakdown values are displayed. Click below to load them." thing locally 🤔 What I still wanted to suggest is, if it wouldn't be better to put the new toggle under options at the top? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I found it, but only with HogQL trends turned off. Is that as intended?
Otherwise, seems to work alright.
!breakdown.breakdown_hide_other_aggregation, | ||
}) | ||
} | ||
label='Group renaming values under "Other"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label='Group renaming values under "Other"' | |
label='Group remaining values under "Other"' |
Thanks for the review! Yes, for now this is only implemented for the non-HogQL trends. I have added "Breakdown controls" as one of the things to fix for the rewrite. I also put an end to the frontend innovation, and moved the button into the sidebar with the other editor filters: There will likely be some changed snapshots because of this. One of the next things we can add here is the option to toggle exactly how many breakdown values are displayed, and which ones, but that's for future PRs. |
📸 UI snapshots have been updated15 snapshot changes in total. 0 added, 15 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated14 snapshot changes in total. 0 added, 14 modified, 0 deleted:
Triggered by this commit. |
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
min={1} | ||
value={breakdownLimit} | ||
onChange={(newValue) => { | ||
setBreakdownLimit(newValue ?? 25) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What doesn't work here for me is typing a value and then focusing somewhere else, thereby closing the menu. That doesn't seem to trigger onChange.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem
Not everyone is happy with the "Other" column.
Changes
Adds a way to remove the column when you edit the chart.
I had to make NULL / None handling for breakdowns very explicit as well. Because of our column materialization, we must also treat
""
as None.How did you test this code?
Backend tests