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

feat(correlation): Enable person-on-events querying #9952

Merged
merged 6 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
  • Loading branch information
neilkakkar committed May 24, 2022
commit 4854ea07a2a9db51d7698843f2d3edae772f7390
7 changes: 4 additions & 3 deletions ee/clickhouse/queries/funnels/funnel_strict.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def get_step_counts_query(self):
inner_timestamps, outer_timestamps = self._get_timestamp_selects()

return f"""
SELECT aggregation_target, steps {self._get_step_time_avgs(max_steps, inner_query=True)} {self._get_step_time_median(max_steps, inner_query=True)} {breakdown_clause} {outer_timestamps} {self._get_matching_event_arrays(max_steps)} FROM (
SELECT aggregation_target, steps, max(steps) over (PARTITION BY aggregation_target {breakdown_clause}) as max_steps {self._get_step_time_names(max_steps)} {breakdown_clause} {inner_timestamps} {self._get_matching_events(max_steps)} FROM (
SELECT aggregation_target, steps {self._get_step_time_avgs(max_steps, inner_query=True)} {self._get_step_time_median(max_steps, inner_query=True)} {breakdown_clause} {outer_timestamps} {self._get_matching_event_arrays(max_steps)} {self._get_person_and_group_properties_aggregate()} FROM (
SELECT aggregation_target, steps, max(steps) over (PARTITION BY aggregation_target {breakdown_clause}) as max_steps {self._get_step_time_names(max_steps)} {breakdown_clause} {inner_timestamps} {self._get_matching_events(max_steps)} {self._get_person_and_group_properties()} FROM (
{steps_per_person_query}
)
) GROUP BY aggregation_target, steps {breakdown_clause}
Expand All @@ -44,11 +44,12 @@ def get_step_counts_without_aggregation_query(self):
timestamp,
{partition_select}
{breakdown_clause}
{self._get_person_and_group_properties()}
FROM ({self._get_inner_event_query(skip_entity_filter=True, skip_step_filter=True)})
"""

formatted_query = f"""
SELECT *, {sorting_condition} AS steps {self._get_step_times(max_steps)}{self._get_matching_events(max_steps)} FROM (
SELECT *, {sorting_condition} AS steps {self._get_step_times(max_steps)}{self._get_matching_events(max_steps)} {self._get_person_and_group_properties()} FROM (
{inner_query}
) WHERE step_0 = 1"""

Expand Down
7 changes: 4 additions & 3 deletions ee/clickhouse/queries/funnels/funnel_unordered.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def get_step_counts_query(self):
inner_timestamps, outer_timestamps = self._get_timestamp_selects()

return f"""
SELECT aggregation_target, steps {self._get_step_time_avgs(max_steps, inner_query=True)} {self._get_step_time_median(max_steps, inner_query=True)} {breakdown_clause} {outer_timestamps} FROM (
SELECT aggregation_target, steps, max(steps) over (PARTITION BY aggregation_target {breakdown_clause}) as max_steps {self._get_step_time_names(max_steps)} {breakdown_clause} {inner_timestamps} FROM (
SELECT aggregation_target, steps {self._get_step_time_avgs(max_steps, inner_query=True)} {self._get_step_time_median(max_steps, inner_query=True)} {breakdown_clause} {outer_timestamps} {self._get_person_and_group_properties_aggregate()} FROM (
SELECT aggregation_target, steps, max(steps) over (PARTITION BY aggregation_target {breakdown_clause}) as max_steps {self._get_step_time_names(max_steps)} {breakdown_clause} {inner_timestamps} {self._get_person_and_group_properties()} FROM (
{union_query}
)
) GROUP BY aggregation_target, steps {breakdown_clause}
Expand All @@ -81,11 +81,12 @@ def get_step_counts_without_aggregation_query(self):
timestamp,
{partition_select}
{breakdown_clause}
{self._get_person_and_group_properties()}
FROM ({self._get_inner_event_query(entities_to_use, f"events_{i}")})
"""

formatted_query = f"""
SELECT *, {sorting_condition} AS steps {exclusion_clause} {self._get_step_times(max_steps)} FROM (
SELECT *, {sorting_condition} AS steps {exclusion_clause} {self._get_step_times(max_steps)} {self._get_person_and_group_properties()} FROM (
{inner_query}
) WHERE step_0 = 1
{'AND exclusion = 0' if exclusion_clause else ''}
Expand Down
Loading