-
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
chore(hogql): Add retention queries in HogQL #18831
Conversation
@mariusandra This is a bit rough from the code maybe, but mostly working. The tests fail at some poe stuff. Let's maybe discuss that tomorrow. Otherwise: Did I miss anything big? |
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.
Didn't get to the end yet, but sharing the comments I already have.
posthog/models/team/team.py
Outdated
@cached_property | ||
@property |
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.
Hmm, why this change?
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.
It tripped up the tests. The test uses a team, asserts something, then sets the team timezone, and tries to assert once more. But due to the timezone property that the test uses being cached here on the instance, it didn't reflect the change. Not sure why it worked in the old tests.
But, I wouldn't recommend to put cached_property
on "simple" properties like these anyways, since they are directly computed from available data and do not need to be queried for or such. It's often times more a source of confusion and stale data than helping performance. Hence I removed it. What do you think?
frontend/src/queries/schema.ts
Outdated
@@ -498,8 +498,13 @@ export interface FunnelsQuery extends InsightsQueryBase { | |||
|
|||
/** `RetentionFilterType` minus everything inherited from `FilterType` */ | |||
export type RetentionFilter = Omit<RetentionFilterType, keyof FilterType> | |||
|
|||
export interface RetentionQueryResponse extends QueryResponse { | |||
results: any[] |
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.
Would be great to have this a bit more complete
# Conflicts: # frontend/src/queries/utils.ts
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated3 snapshot changes in total. 0 added, 3 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated3 snapshot changes in total. 0 added, 3 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 updated1 snapshot changes in total. 0 added, 1 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 updated1 snapshot changes in total. 0 added, 1 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 updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
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 think this looks good! Great work! 👍
Still some tests / types to fix though, and then the persons modal stuff... but otherwise, let's get it in!
} | ||
result.retentionFilter = {} // Put this here to make TS happy |
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.
It seems to make TS unhappy...
I don't understand why we need it. Shouldn't filtersToQueryNode
take care of stuff like that?
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 have the query typed to require retentionFilter
, hence added it, but since it's empty the result var didn't contain it and the equal test was failing. Anyway, I just used a cast to bypass issues now.
# Conflicts: # frontend/__snapshots__/scenes-app-sidepanels--side-panel-settings.png
Problem
We want to convert the retention queries to use HogQL as well.
Changes
How did you test this code?