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

fix(cohorts): Restrict query by time range #21621

Merged
merged 6 commits into from
Apr 17, 2024
Merged

fix(cohorts): Restrict query by time range #21621

merged 6 commits into from
Apr 17, 2024

Conversation

neilkakkar
Copy link
Collaborator

Problem

I overlooked the part where we have a time range filter on cohorts, making exposure cohort queries (and any with explicit datetime) run farrr longer than they should 😬

Fixes that!

Changes

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

@neilkakkar neilkakkar marked this pull request as ready for review April 17, 2024 16:55
@neilkakkar neilkakkar enabled auto-merge (squash) April 17, 2024 17:16
@neilkakkar
Copy link
Collaborator Author

Enabling automerge so cohorts don't start struggling, but will accept all post-humous reviews

@neilkakkar neilkakkar disabled auto-merge April 17, 2024 17:21
@@ -508,6 +508,9 @@ def assertQueryMatchesSnapshot(self, query, params=None, replace_all_numbers=Fal
query,
)

# replace explicit timestamps in cohort queries
query = re.sub(r"timestamp > '20\d\d-\d\d-\d\d \d\d:\d\d:\d\d'", r"timestamp > 'explicit_timestamp'", query)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I want this to fail in the year 2100 😂

@neilkakkar neilkakkar enabled auto-merge (squash) April 17, 2024 18:16
@neilkakkar neilkakkar merged commit 703e0b8 into master Apr 17, 2024
96 checks passed
@neilkakkar neilkakkar deleted the fix-exp-cohort branch April 17, 2024 18:20
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.

1 participant