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(hogql): fix edge cases when converting real world lifecycle filters #17728

Closed
wants to merge 5 commits into from

Conversation

thmsobrmlr
Copy link
Contributor

@thmsobrmlr thmsobrmlr commented Oct 3, 2023

Problem

We need to make the backend side filter_to_query conversion function robust against real-world edge cases.

Changes

This PR fixes problems in the conversion for all existing lifecycle filters. The filters were obtained via metabase:

SELECT DISTINCT filters
FROM posthog_dashboarditem 
WHERE filters->>'insight' = 'LIFECYCLE'

How did you test this code?

Added test examples that were then fixed

@thmsobrmlr thmsobrmlr requested a review from a team October 4, 2023 10:27
@@ -27,17 +28,72 @@
from posthog.types import InsightQueryNode


def entity_to_node(entity: BackendEntity) -> EventsNode | ActionsNode:
def is_property_with_operator(property: Dict):
Copy link
Member

Choose a reason for hiding this comment

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

Note that the frontend has isPropertyFilterWithOperator, but it works differently

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I actually forgot we have something similar on the frontend. Will adapt the naming in the follow up PR, as this got superseded by work in #17813.

@thmsobrmlr
Copy link
Contributor Author

Superseded by #17813

@thmsobrmlr thmsobrmlr closed this Oct 6, 2023
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.

2 participants