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 clickhouse #2052

Merged
merged 14 commits into from
Oct 27, 2020
Merged

Fix cohorts clickhouse #2052

merged 14 commits into from
Oct 27, 2020

Conversation

timgl
Copy link
Collaborator

@timgl timgl commented Oct 27, 2020

Changes

  • Move to using JSONExtract rather than person_properties_view, as that table wasn't up to date
  • Fixed a bunch of other small issues with person and cohort filtering

Checklist

  • All querysets/queries filter by Organization, Team, and User (if this PR affects ANY querysets/queries).
  • Django backend tests (if this PR affects the backend).
  • Cypress end-to-end tests (if this PR affects the frontend).

@timgl timgl temporarily deployed to posthog-fix-cohorts-cli-cqdf3r October 27, 2020 16:58 Inactive
@timgl timgl temporarily deployed to posthog-fix-cohorts-cli-cqdf3r October 27, 2020 17:02 Inactive
@timgl timgl temporarily deployed to posthog-fix-cohorts-cli-cqdf3r October 27, 2020 18:00 Inactive
@timgl timgl temporarily deployed to posthog-fix-cohorts-cli-cqdf3r October 27, 2020 18:57 Inactive
@timgl timgl temporarily deployed to posthog-fix-cohorts-cli-cqdf3r October 27, 2020 19:45 Inactive
@timgl timgl requested a review from EDsCODE October 27, 2020 19:49
@timgl timgl marked this pull request as ready for review October 27, 2020 19:49
@timgl timgl temporarily deployed to posthog-fix-cohorts-cli-cqdf3r October 27, 2020 19:51 Inactive
@timgl timgl temporarily deployed to posthog-fix-cohorts-cli-cqdf3r October 27, 2020 19:53 Inactive
filter_query, filter_params = prop_filter_json_extract(prop, idx, "{}person".format(prepend))
final += " AND distinct_id IN ({filter_query})".format(
filter_query=GET_DISTINCT_IDS_BY_PROPERTY_SQL.format(
filters=filter_query, negation="" if prop.operator and "not" in prop.operator else ""
Copy link
Member

Choose a reason for hiding this comment

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

i'm might be wrong because the tests pass but something could be double negated here. Since prop_filter_json_extract should provide a query that includes 'NOT', there should be no need for negation here because before the conditions didn't include NOT directly and relied on this outside negation

Copy link
Member

Choose a reason for hiding this comment

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

oh i see you removed the NOT, so this entire clause can be removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great spot! Done and merged :)

Copy link
Member

@EDsCODE EDsCODE left a comment

Choose a reason for hiding this comment

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

lgtm, just have to remove that empty clause

@timgl timgl temporarily deployed to posthog-fix-cohorts-cli-cqdf3r October 27, 2020 20:31 Inactive
Copy link
Member

@fuziontech fuziontech left a comment

Choose a reason for hiding this comment

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

:shipit:

@timgl timgl merged commit c8bf1d0 into master Oct 27, 2020
@timgl timgl deleted the fix-cohorts-clickhouse branch October 27, 2020 20:43
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.

None yet

3 participants