fix: trends breakdowns should have attribution type (#26737)

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Sandy Spicer
2024-12-11 09:59:58 +00:00
committed by GitHub
parent 12f49ac033
commit bd478a800f
26 changed files with 872 additions and 1926 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

@@ -77,7 +77,7 @@ export function EditorFilters({ query, showing, embedded }: EditorFiltersProps):
isStepsFunnel ||
isTrendsFunnel
const hasPathsAdvanced = hasAvailableFeature(AvailableFeature.PATHS_ADVANCED)
const hasAttribution = isStepsFunnel
const hasAttribution = isStepsFunnel || isTrendsFunnel
const hasPathsHogQL = isPaths && pathsFilter?.includeEventTypes?.includes(PathType.HogQL)
const editorFilters: InsightEditorFilterGroup[] = [

View File

@@ -217,7 +217,7 @@ impl AggregateFunnelRow {
}
}
} else {
let is_unmatched_step_attribution = self.breakdown_step.map(|breakdown_step| step == breakdown_step - 1).unwrap_or(false) && *prop_val != event.breakdown;
let is_unmatched_step_attribution = self.breakdown_step.map(|breakdown_step| step - 1 == breakdown_step).unwrap_or(false) && *prop_val != event.breakdown;
let already_used_event = processing_multiple_events && vars.entered_timestamp[step - 1].uuids.contains(&event.uuid);
if !is_unmatched_step_attribution && !already_used_event {
let new_entered_timestamp = |vars: &Vars| -> EnteredTimestamp {

View File

@@ -66,13 +66,15 @@ struct IntervalData {
entered_timestamp: Vec<EnteredTimestamp>,
}
type ResultsMap = HashMap<u64, ResultStruct>;
struct Vars {
interval_start_to_entered_timestamps: HashMap<u64, IntervalData>,
results: ResultsMap,
}
struct AggregateFunnelRow {
breakdown_step: Option<usize>,
results: HashMap<u64, ResultStruct>,
}
const DEFAULT_ENTERED_TIMESTAMP: EnteredTimestamp = EnteredTimestamp {
@@ -83,11 +85,9 @@ const DEFAULT_ENTERED_TIMESTAMP: EnteredTimestamp = EnteredTimestamp {
pub fn process_line(line: &str) -> Value {
let args = parse_args(line);
let mut aggregate_funnel_row = AggregateFunnelRow {
results: HashMap::new(),
breakdown_step: Option::None,
};
aggregate_funnel_row.calculate_funnel_from_user_events(&args);
let result: Vec<ResultStruct> = aggregate_funnel_row.results.into_values().collect();
let result: Vec<ResultStruct> = aggregate_funnel_row.calculate_funnel_from_user_events(&args);
json!({ "result": result })
}
@@ -98,17 +98,21 @@ fn parse_args(line: &str) -> Args {
impl AggregateFunnelRow {
#[inline(always)]
fn calculate_funnel_from_user_events(&mut self, args: &Args) {
fn calculate_funnel_from_user_events(&mut self, args: &Args) -> Vec<ResultStruct> {
if args.breakdown_attribution_type.starts_with("step_") {
self.breakdown_step = args.breakdown_attribution_type[5..].parse::<usize>().ok()
}
args.prop_vals.iter().for_each(|prop_val| self.loop_prop_val(args, prop_val));
args.prop_vals.iter().flat_map(|prop_val| {
let results_map= self.loop_prop_val(args, prop_val);
results_map.into_values().collect::<Vec<ResultStruct>>()
}).collect()
}
#[inline(always)]
fn loop_prop_val(&mut self, args: &Args, prop_val: &PropVal) {
fn loop_prop_val(&mut self, args: &Args, prop_val: &PropVal) -> ResultsMap {
let mut vars = Vars {
results: HashMap::new(),
interval_start_to_entered_timestamps: HashMap::new(),
};
@@ -139,11 +143,13 @@ impl AggregateFunnelRow {
let fully_excluded = vars.interval_start_to_entered_timestamps.values().find(|interval_data| interval_data.max_step.excluded == Exclusion::Full);
if fully_excluded.is_none() {
for (interval_start, interval_data) in vars.interval_start_to_entered_timestamps.into_iter() {
if !self.results.contains_key(&interval_start) && interval_data.max_step.step >= args.from_step + 1 && interval_data.max_step.excluded != Exclusion::Partial {
self.results.insert(interval_start, ResultStruct(interval_start, -1, prop_val.clone(), interval_data.max_step.event_uuid));
if !vars.results.contains_key(&interval_start) && interval_data.max_step.step >= args.from_step + 1 && interval_data.max_step.excluded != Exclusion::Partial {
vars.results.insert(interval_start, ResultStruct(interval_start, -1, prop_val.clone(), interval_data.max_step.event_uuid));
}
}
}
vars.results
}
#[inline(always)]
@@ -163,8 +169,10 @@ impl AggregateFunnelRow {
*step
}) as usize;
let is_unmatched_step_attribution = self.breakdown_step.map(|breakdown_step| step - 1 == breakdown_step).unwrap_or(false) && *prop_val != event.breakdown;
if step == 1 {
if !self.results.contains_key(&event.interval_start) {
if !is_unmatched_step_attribution && !vars.results.contains_key(&event.interval_start) {
let entered_timestamp_one = EnteredTimestamp { timestamp: event.timestamp, excluded: false };
let interval = vars.interval_start_to_entered_timestamps.get_mut(&event.interval_start);
if interval.is_none() || interval.as_ref().map( | interval | interval.max_step.step == 1 && interval.max_step.excluded != Exclusion::Not).unwrap() {
@@ -201,7 +209,6 @@ impl AggregateFunnelRow {
}
}
} else {
let is_unmatched_step_attribution = self.breakdown_step.map(|breakdown_step| step == breakdown_step - 1).unwrap_or(false) && *prop_val != event.breakdown;
if !is_unmatched_step_attribution {
if !previous_step_excluded {
interval_data.entered_timestamp[step] = EnteredTimestamp {
@@ -211,7 +218,7 @@ impl AggregateFunnelRow {
}
// check if we have hit the goal. if we have, remove it from the list and add it to the successful_timestamps
if interval_data.entered_timestamp[args.num_steps].timestamp != 0.0 {
self.results.insert(
vars.results.insert(
interval_start,
ResultStruct(interval_start, 1, prop_val.clone(), event.uuid)
);

View File

@@ -7,6 +7,7 @@ from posthog.hogql.constants import HogQLQuerySettings
from posthog.hogql.parser import parse_select, parse_expr
from posthog.hogql_queries.insights.funnels import FunnelTrends
from posthog.hogql_queries.insights.funnels.base import JOIN_ALGOS
from posthog.hogql_queries.insights.funnels.funnel_udf import FunnelUDFMixin
from posthog.hogql_queries.insights.utils.utils import get_start_of_interval_hogql_str
from posthog.schema import BreakdownType, BreakdownAttributionType
from posthog.utils import DATERANGE_MAP, relative_date_parse
@@ -15,7 +16,7 @@ TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S"
HUMAN_READABLE_TIMESTAMP_FORMAT = "%-d-%b-%Y"
class FunnelTrendsUDF(FunnelTrends):
class FunnelTrendsUDF(FunnelUDFMixin, FunnelTrends):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# In base, these fields only get added if you're running an actors query
@@ -65,8 +66,6 @@ class FunnelTrendsUDF(FunnelTrends):
else:
inner_event_query = self._get_inner_event_query_for_udf(entity_name="events")
default_breakdown_selector = "[]" if self._query_has_array_breakdown() else "''"
# stores the steps as an array of integers from 1 to max_steps
# so if the event could be step_0, step_1 or step_4, it looks like [1,2,0,0,5]
@@ -89,8 +88,7 @@ class FunnelTrendsUDF(FunnelTrends):
fn = "aggregate_funnel_trends"
breakdown_prop = ""
prop_selector = "prop" if self.context.breakdown else default_breakdown_selector
prop_vals = "groupUniqArray(prop)" if self.context.breakdown else f"[{default_breakdown_selector}]"
prop_selector = "prop" if self.context.breakdown else self._default_breakdown_selector()
breakdown_attribution_string = f"{self.context.breakdownAttributionType}{f'_{self.context.funnelsFilter.breakdownAttributionValue}' if self.context.breakdownAttributionType == BreakdownAttributionType.STEP else ''}"
@@ -114,7 +112,7 @@ class FunnelTrendsUDF(FunnelTrends):
{self.conversion_window_limit()},
'{breakdown_attribution_string}',
'{self.context.funnelsFilter.funnelOrderType}',
{prop_vals},
{self._prop_vals()},
{self.udf_event_array_filter()}
)) as af_tuple,
toTimeZone(toDateTime(_toUInt64(af_tuple.1)), '{self.context.team.timezone}') as entrance_period_start,

View File

@@ -1,17 +1,78 @@
from typing import cast, Optional
from typing import cast, Optional, runtime_checkable
from posthog.hogql import ast
from posthog.hogql.constants import DEFAULT_RETURNED_ROWS, HogQLQuerySettings
from posthog.hogql.parser import parse_select, parse_expr
from posthog.hogql_queries.insights.funnels.base import FunnelBase, JOIN_ALGOS
from posthog.hogql_queries.insights.funnels.funnel_query_context import FunnelQueryContext
from posthog.schema import BreakdownType, BreakdownAttributionType
from posthog.utils import DATERANGE_MAP
from typing import Protocol
@runtime_checkable
class FunnelProtocol(Protocol):
context: FunnelQueryContext
def _query_has_array_breakdown(self) -> bool: ...
def _default_breakdown_selector(self) -> str: ...
TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S"
HUMAN_READABLE_TIMESTAMP_FORMAT = "%-d-%b-%Y"
class FunnelUDF(FunnelBase):
class FunnelUDFMixin:
def _add_breakdown_attribution_subquery(self: FunnelProtocol, inner_query: ast.SelectQuery) -> ast.SelectQuery:
breakdown, breakdownAttributionType = (
self.context.breakdown,
self.context.breakdownAttributionType,
)
if breakdownAttributionType in [
BreakdownAttributionType.FIRST_TOUCH,
BreakdownAttributionType.LAST_TOUCH,
]:
# When breaking down by first/last touch, each person can only have one prop value
# so just select that. Except for the empty case, where we select the default.
if self._query_has_array_breakdown():
assert isinstance(breakdown, list)
default_breakdown_value = f"""[{','.join(["''" for _ in range(len(breakdown or []))])}]"""
# default is [''] when dealing with a single breakdown array, otherwise ['', '', ...., '']
breakdown_selector = parse_expr(
f"if(notEmpty(arrayFilter(x -> notEmpty(x), prop_vals)), prop_vals, {default_breakdown_value})"
)
else:
breakdown_selector = ast.Field(chain=["prop_vals"])
return ast.SelectQuery(
select=[ast.Field(chain=["*"]), ast.Alias(alias="prop", expr=breakdown_selector)],
select_from=ast.JoinExpr(table=inner_query),
)
return inner_query
def _prop_vals(self: FunnelProtocol):
prop_vals = f"[{self._default_breakdown_selector()}]"
if self.context.breakdown:
if self.context.breakdownAttributionType == BreakdownAttributionType.STEP:
prop = f"prop_{self.context.funnelsFilter.breakdownAttributionValue}"
else:
prop = "prop"
if self._query_has_array_breakdown():
prop_vals = f"groupUniqArrayIf({prop}, {prop} != [])"
else:
prop_vals = f"groupUniqArray({prop})"
return prop_vals
def _default_breakdown_selector(self: FunnelProtocol) -> str:
return "[]" if self._query_has_array_breakdown() else "''"
class FunnelUDF(FunnelUDFMixin, FunnelBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# In base, these fields only get added if you're running an actors query
@@ -50,8 +111,6 @@ class FunnelUDF(FunnelBase):
else:
inner_event_query = self._get_inner_event_query_for_udf(entity_name="events")
default_breakdown_selector = "[]" if self._query_has_array_breakdown() else "''"
# stores the steps as an array of integers from 1 to max_steps
# so if the event could be step_0, step_1 or step_4, it looks like [1,2,0,0,5]
@@ -73,8 +132,9 @@ class FunnelUDF(FunnelBase):
fn = "aggregate_funnel"
breakdown_prop = ""
prop_selector = "prop" if self.context.breakdown else default_breakdown_selector
prop_vals = "groupUniqArray(prop)" if self.context.breakdown else f"[{default_breakdown_selector}]"
prop_selector = "prop" if self.context.breakdown else self._default_breakdown_selector()
prop_vals = self._prop_vals()
breakdown_attribution_string = f"{self.context.breakdownAttributionType}{f'_{self.context.funnelsFilter.breakdownAttributionValue}' if self.context.breakdownAttributionType == BreakdownAttributionType.STEP else ''}"

View File

@@ -27,7 +27,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -120,7 +120,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -206,7 +206,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)

View File

@@ -22,7 +22,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -74,7 +74,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -137,7 +137,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -202,7 +202,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -266,7 +266,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -361,7 +361,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -456,7 +456,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -551,7 +551,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -645,7 +645,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -710,7 +710,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -774,7 +774,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -869,7 +869,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -964,7 +964,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1059,7 +1059,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1155,7 +1155,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1202,7 +1202,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1260,7 +1260,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1307,7 +1307,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1360,7 +1360,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1405,7 +1405,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1461,7 +1461,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1524,7 +1524,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1587,7 +1587,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1650,7 +1650,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1710,7 +1710,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1763,7 +1763,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1827,7 +1827,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1890,7 +1890,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1950,7 +1950,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1995,7 +1995,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2051,7 +2051,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2114,7 +2114,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2177,7 +2177,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2240,7 +2240,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2300,7 +2300,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2353,7 +2353,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2417,7 +2417,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2480,7 +2480,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2543,7 +2543,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2600,7 +2600,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2655,7 +2655,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2725,7 +2725,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2795,7 +2795,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2865,7 +2865,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2936,7 +2936,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -2993,7 +2993,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3049,7 +3049,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3106,7 +3106,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3161,7 +3161,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3231,7 +3231,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3301,7 +3301,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3371,7 +3371,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3442,7 +3442,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3499,7 +3499,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3555,7 +3555,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3612,7 +3612,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3667,7 +3667,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3737,7 +3737,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3807,7 +3807,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3877,7 +3877,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -3948,7 +3948,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4005,7 +4005,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4061,7 +4061,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4118,7 +4118,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4173,7 +4173,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4243,7 +4243,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4313,7 +4313,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4383,7 +4383,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4454,7 +4454,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4511,7 +4511,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4567,7 +4567,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4624,7 +4624,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4679,7 +4679,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4749,7 +4749,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4819,7 +4819,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4889,7 +4889,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -4960,7 +4960,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -5017,7 +5017,7 @@
first_timestamp
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)

View File

@@ -10,7 +10,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -85,7 +85,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -160,7 +160,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)

View File

@@ -1106,243 +1106,3 @@
allow_experimental_analyzer=1
'''
# ---
# name: TestStrictFunnelGroupBreakdown.test_funnel_breakdown_group.5
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestStrictFunnelGroupBreakdown.test_funnel_breakdown_group.6
'''
SELECT aggregation_target AS actor_id
FROM
(SELECT aggregation_target,
steps,
avg(step_1_conversion_time) step_1_average_conversion_time_inner,
avg(step_2_conversion_time) step_2_average_conversion_time_inner,
median(step_1_conversion_time) step_1_median_conversion_time_inner,
median(step_2_conversion_time) step_2_median_conversion_time_inner,
prop
FROM
(SELECT aggregation_target,
steps,
max(steps) over (PARTITION BY aggregation_target,
prop) as max_steps,
step_1_conversion_time,
step_2_conversion_time,
prop
FROM
(SELECT *,
if(latest_0 <= latest_1
AND latest_1 <= latest_0 + INTERVAL 7 DAY
AND latest_1 <= latest_2
AND latest_2 <= latest_0 + INTERVAL 7 DAY, 3, if(latest_0 <= latest_1
AND latest_1 <= latest_0 + INTERVAL 7 DAY, 2, 1)) AS steps,
if(isNotNull(latest_1)
AND latest_1 <= latest_0 + INTERVAL 7 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time,
if(isNotNull(latest_2)
AND latest_2 <= latest_1 + INTERVAL 7 DAY, dateDiff('second', toDateTime(latest_1), toDateTime(latest_2)), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN 2 PRECEDING AND 2 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'sign up', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'play movie', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'buy', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (1=1) )))
WHERE step_0 = 1 ))
GROUP BY aggregation_target,
steps,
prop
HAVING steps = max(max_steps))
WHERE steps IN [1, 2, 3]
AND arrayFlatten(array(prop)) = arrayFlatten(array('technology'))
ORDER BY aggregation_target
LIMIT 100
OFFSET 0 SETTINGS max_ast_elements=1000000,
max_expanded_ast_elements=1000000
'''
# ---
# name: TestStrictFunnelGroupBreakdown.test_funnel_breakdown_group.7
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestStrictFunnelGroupBreakdown.test_funnel_breakdown_group.8
'''
SELECT aggregation_target AS actor_id
FROM
(SELECT aggregation_target,
steps,
avg(step_1_conversion_time) step_1_average_conversion_time_inner,
avg(step_2_conversion_time) step_2_average_conversion_time_inner,
median(step_1_conversion_time) step_1_median_conversion_time_inner,
median(step_2_conversion_time) step_2_median_conversion_time_inner,
prop
FROM
(SELECT aggregation_target,
steps,
max(steps) over (PARTITION BY aggregation_target,
prop) as max_steps,
step_1_conversion_time,
step_2_conversion_time,
prop
FROM
(SELECT *,
if(latest_0 <= latest_1
AND latest_1 <= latest_0 + INTERVAL 7 DAY
AND latest_1 <= latest_2
AND latest_2 <= latest_0 + INTERVAL 7 DAY, 3, if(latest_0 <= latest_1
AND latest_1 <= latest_0 + INTERVAL 7 DAY, 2, 1)) AS steps,
if(isNotNull(latest_1)
AND latest_1 <= latest_0 + INTERVAL 7 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time,
if(isNotNull(latest_2)
AND latest_2 <= latest_1 + INTERVAL 7 DAY, dateDiff('second', toDateTime(latest_1), toDateTime(latest_2)), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN 2 PRECEDING AND 2 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'sign up', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'play movie', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'buy', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (1=1) )))
WHERE step_0 = 1 ))
GROUP BY aggregation_target,
steps,
prop
HAVING steps = max(max_steps))
WHERE steps IN [2, 3]
AND arrayFlatten(array(prop)) = arrayFlatten(array('technology'))
ORDER BY aggregation_target
LIMIT 100
OFFSET 0 SETTINGS max_ast_elements=1000000,
max_expanded_ast_elements=1000000
'''
# ---

View File

@@ -10,7 +10,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'strict', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'strict', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -85,7 +85,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'strict', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'strict', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -160,7 +160,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'strict', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'strict', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)

View File

@@ -15,11 +15,12 @@
if(ifNull(less(row_number, 25), 0), breakdown, ['Other']) AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'strict', groupUniqArrayIf(prop, ifNull(notEquals(prop, []), isNotNull(prop)
or isNotNull([]))), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
af_tuple.1 AS step_reached,
plus(af_tuple.1, 1) AS steps,
af_tuple.2 AS breakdown,
@@ -89,55 +90,39 @@
if(ifNull(less(row_number, 25), 0), breakdown, ['Other']) AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'step_1', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'step_1', 'strict', groupUniqArrayIf(prop_1, ifNull(notEquals(prop_1, []), isNotNull(prop_1)
or isNotNull([]))), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
af_tuple.1 AS step_reached,
plus(af_tuple.1, 1) AS steps,
af_tuple.2 AS breakdown,
af_tuple.3 AS timings,
aggregation_target AS aggregation_target
FROM
(SELECT timestamp AS timestamp,
aggregation_target AS aggregation_target,
uuid AS uuid,
`$session_id` AS `$session_id`,
`$window_id` AS `$window_id`,
step_0 AS step_0,
step_1 AS step_1,
prop_basic AS prop_basic,
prop_0 AS prop_0,
prop_1 AS prop_1,
prop,
prop_vals AS prop_vals,
prop
FROM
(SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,
if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,
e.uuid AS uuid,
e.`$session_id` AS `$session_id`,
e.`$window_id` AS `$window_id`,
if(equals(e.event, 'sign up'), 1, 0) AS step_0,
if(and(equals(e.event, 'buy'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$version'), ''), 'null'), '^"|"$', ''), 'xyz'), 0)), 1, 0) AS step_1,
[ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', '')), '')] AS prop_basic,
if(ifNull(equals(step_0, 1), 0), prop_basic, []) AS prop_0,
if(ifNull(equals(step_1, 1), 0), prop_basic, []) AS prop_1,
prop_1 AS prop,
groupUniqArray(prop) OVER (PARTITION BY aggregation_target) AS prop_vals
FROM events AS e
LEFT OUTER JOIN
(SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)
WHERE and(equals(e.team_id, 99999), and(greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), toDateTime64('2020-01-08 23:59:59.999999', 6, 'UTC'))))) ARRAY
JOIN prop_vals AS prop
WHERE ifNull(notEquals(prop, []), isNotNull(prop)
or isNotNull([])))
(SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,
if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,
e.uuid AS uuid,
e.`$session_id` AS `$session_id`,
e.`$window_id` AS `$window_id`,
if(equals(e.event, 'sign up'), 1, 0) AS step_0,
if(and(equals(e.event, 'buy'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$version'), ''), 'null'), '^"|"$', ''), 'xyz'), 0)), 1, 0) AS step_1,
[ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', '')), '')] AS prop_basic,
if(ifNull(equals(step_0, 1), 0), prop_basic, []) AS prop_0,
if(ifNull(equals(step_1, 1), 0), prop_basic, []) AS prop_1,
prop_1 AS prop,
groupUniqArray(prop) OVER (PARTITION BY aggregation_target) AS prop_vals
FROM events AS e
LEFT OUTER JOIN
(SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)
WHERE and(equals(e.team_id, 99999), and(greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), toDateTime64('2020-01-08 23:59:59.999999', 6, 'UTC')))))
GROUP BY aggregation_target
HAVING ifNull(greaterOrEquals(step_reached, 0), 0))
GROUP BY breakdown
@@ -170,11 +155,12 @@
if(ifNull(less(row_number, 25), 0), breakdown, ['Other']) AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'strict', groupUniqArrayIf(prop, ifNull(notEquals(prop, []), isNotNull(prop)
or isNotNull([]))), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
af_tuple.1 AS step_reached,
plus(af_tuple.1, 1) AS steps,
af_tuple.2 AS breakdown,
@@ -249,7 +235,7 @@
if(ifNull(less(row_number, 25), 0), breakdown, 'Other') AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -331,7 +317,7 @@
if(ifNull(less(row_number, 25), 0), breakdown, 'Other') AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -413,7 +399,7 @@
if(ifNull(less(row_number, 25), 0), breakdown, 'Other') AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -490,7 +476,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -570,7 +556,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -650,7 +636,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -730,7 +716,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'strict', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -801,243 +787,3 @@
allow_experimental_analyzer=1
'''
# ---
# name: TestStrictFunnelGroupBreakdownUDF.test_funnel_breakdown_group.5
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestStrictFunnelGroupBreakdownUDF.test_funnel_breakdown_group.6
'''
SELECT aggregation_target AS actor_id
FROM
(SELECT aggregation_target,
steps,
avg(step_1_conversion_time) step_1_average_conversion_time_inner,
avg(step_2_conversion_time) step_2_average_conversion_time_inner,
median(step_1_conversion_time) step_1_median_conversion_time_inner,
median(step_2_conversion_time) step_2_median_conversion_time_inner,
prop
FROM
(SELECT aggregation_target,
steps,
max(steps) over (PARTITION BY aggregation_target,
prop) as max_steps,
step_1_conversion_time,
step_2_conversion_time,
prop
FROM
(SELECT *,
if(latest_0 <= latest_1
AND latest_1 <= latest_0 + INTERVAL 7 DAY
AND latest_1 <= latest_2
AND latest_2 <= latest_0 + INTERVAL 7 DAY, 3, if(latest_0 <= latest_1
AND latest_1 <= latest_0 + INTERVAL 7 DAY, 2, 1)) AS steps,
if(isNotNull(latest_1)
AND latest_1 <= latest_0 + INTERVAL 7 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time,
if(isNotNull(latest_2)
AND latest_2 <= latest_1 + INTERVAL 7 DAY, dateDiff('second', toDateTime(latest_1), toDateTime(latest_2)), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN 2 PRECEDING AND 2 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'sign up', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'play movie', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'buy', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (1=1) )))
WHERE step_0 = 1 ))
GROUP BY aggregation_target,
steps,
prop
HAVING steps = max(max_steps))
WHERE steps IN [1, 2, 3]
AND arrayFlatten(array(prop)) = arrayFlatten(array('technology'))
ORDER BY aggregation_target
LIMIT 100
OFFSET 0 SETTINGS max_ast_elements=1000000,
max_expanded_ast_elements=1000000
'''
# ---
# name: TestStrictFunnelGroupBreakdownUDF.test_funnel_breakdown_group.7
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestStrictFunnelGroupBreakdownUDF.test_funnel_breakdown_group.8
'''
SELECT aggregation_target AS actor_id
FROM
(SELECT aggregation_target,
steps,
avg(step_1_conversion_time) step_1_average_conversion_time_inner,
avg(step_2_conversion_time) step_2_average_conversion_time_inner,
median(step_1_conversion_time) step_1_median_conversion_time_inner,
median(step_2_conversion_time) step_2_median_conversion_time_inner,
prop
FROM
(SELECT aggregation_target,
steps,
max(steps) over (PARTITION BY aggregation_target,
prop) as max_steps,
step_1_conversion_time,
step_2_conversion_time,
prop
FROM
(SELECT *,
if(latest_0 <= latest_1
AND latest_1 <= latest_0 + INTERVAL 7 DAY
AND latest_1 <= latest_2
AND latest_2 <= latest_0 + INTERVAL 7 DAY, 3, if(latest_0 <= latest_1
AND latest_1 <= latest_0 + INTERVAL 7 DAY, 2, 1)) AS steps,
if(isNotNull(latest_1)
AND latest_1 <= latest_0 + INTERVAL 7 DAY, dateDiff('second', toDateTime(latest_0), toDateTime(latest_1)), NULL) step_1_conversion_time,
if(isNotNull(latest_2)
AND latest_2 <= latest_1 + INTERVAL 7 DAY, dateDiff('second', toDateTime(latest_1), toDateTime(latest_2)), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN 2 PRECEDING AND 2 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'sign up', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'play movie', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'buy', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (1=1) )))
WHERE step_0 = 1 ))
GROUP BY aggregation_target,
steps,
prop
HAVING steps = max(max_steps))
WHERE steps IN [2, 3]
AND arrayFlatten(array(prop)) = arrayFlatten(array('technology'))
ORDER BY aggregation_target
LIMIT 100
OFFSET 0 SETTINGS max_ast_elements=1000000,
max_expanded_ast_elements=1000000
'''
# ---

View File

@@ -10,7 +10,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), toUInt64(toDateTime(toStartOfDay(timestamp), 'UTC')), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_trends_v3(0, 2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
arrayJoin(aggregate_funnel_array_trends_v4(0, 2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
and isNull(x_before.5)), ifNull(equals(x.5, x_after.5), isNull(x.5)
and isNull(x_after.5)), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
@@ -83,7 +83,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), toUInt64(toDateTime(toStartOfDay(timestamp), 'UTC')), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_trends_v3(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
arrayJoin(aggregate_funnel_array_trends_v4(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
and isNull(x_before.5)), ifNull(equals(x.5, x_after.5), isNull(x.5)
and isNull(x_after.5)), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
@@ -156,7 +156,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), toUInt64(toDateTime(toStartOfDay(timestamp), 'UTC')), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_trends_v3(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
arrayJoin(aggregate_funnel_array_trends_v4(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
and isNull(x_before.5)), ifNull(equals(x.5, x_after.5), isNull(x.5)
and isNull(x_after.5)), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)

View File

@@ -8,7 +8,7 @@
data.breakdown AS prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), toUInt64(toDateTime(toStartOfDay(timestamp), 'UTC')), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_trends_v3(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
arrayJoin(aggregate_funnel_array_trends_v4(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
and isNull(x_before.5)), ifNull(equals(x.5, x_after.5), isNull(x.5)
and isNull(x_after.5)), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
@@ -61,7 +61,7 @@
data.breakdown AS prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), toUInt64(toDateTime(toStartOfDay(timestamp), 'US/Pacific')), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_trends_v3(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
arrayJoin(aggregate_funnel_array_trends_v4(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
and isNull(x_before.5)), ifNull(equals(x.5, x_after.5), isNull(x.5)
and isNull(x_after.5)), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
@@ -114,7 +114,7 @@
data.breakdown AS prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), toUInt64(toDateTime(toStartOfWeek(timestamp, 0), 'UTC')), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_trends_v3(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
arrayJoin(aggregate_funnel_array_trends_v4(0, 3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.5), 1), 0), ifNull(equals(x.5, x_before.5), isNull(x.5)
and isNull(x_before.5)), ifNull(equals(x.5, x_after.5), isNull(x.5)
and isNull(x_after.5)), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)

View File

@@ -20,7 +20,7 @@
breakdown AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 15, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 15, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -74,7 +74,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 15, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 15, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -150,7 +150,7 @@
breakdown AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -230,7 +230,7 @@
breakdown AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -297,7 +297,7 @@
breakdown AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -362,7 +362,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -429,7 +429,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -496,7 +496,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(3, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -578,7 +578,7 @@
breakdown AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -640,7 +640,7 @@
breakdown AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, [], arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', [[]], arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -699,11 +699,12 @@
if(ifNull(less(row_number, 25), 0), breakdown, ['Other']) AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', groupUniqArrayIf(prop, ifNull(notEquals(prop, []), isNotNull(prop)
or isNotNull([]))), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
af_tuple.1 AS step_reached,
plus(af_tuple.1, 1) AS steps,
af_tuple.2 AS breakdown,
@@ -773,55 +774,39 @@
if(ifNull(less(row_number, 25), 0), breakdown, ['Other']) AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'step_1', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'step_1', 'ordered', groupUniqArrayIf(prop_1, ifNull(notEquals(prop_1, []), isNotNull(prop_1)
or isNotNull([]))), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
af_tuple.1 AS step_reached,
plus(af_tuple.1, 1) AS steps,
af_tuple.2 AS breakdown,
af_tuple.3 AS timings,
aggregation_target AS aggregation_target
FROM
(SELECT timestamp AS timestamp,
aggregation_target AS aggregation_target,
uuid AS uuid,
`$session_id` AS `$session_id`,
`$window_id` AS `$window_id`,
step_0 AS step_0,
step_1 AS step_1,
prop_basic AS prop_basic,
prop_0 AS prop_0,
prop_1 AS prop_1,
prop,
prop_vals AS prop_vals,
prop
FROM
(SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,
if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,
e.uuid AS uuid,
e.`$session_id` AS `$session_id`,
e.`$window_id` AS `$window_id`,
if(equals(e.event, 'sign up'), 1, 0) AS step_0,
if(and(equals(e.event, 'buy'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$version'), ''), 'null'), '^"|"$', ''), 'xyz'), 0)), 1, 0) AS step_1,
[ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', '')), '')] AS prop_basic,
if(ifNull(equals(step_0, 1), 0), prop_basic, []) AS prop_0,
if(ifNull(equals(step_1, 1), 0), prop_basic, []) AS prop_1,
prop_1 AS prop,
groupUniqArray(prop) OVER (PARTITION BY aggregation_target) AS prop_vals
FROM events AS e
LEFT OUTER JOIN
(SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)
WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), toDateTime64('2020-01-08 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('buy', 'sign up'))), or(ifNull(equals(step_0, 1), 0), ifNull(equals(step_1, 1), 0)))) ARRAY
JOIN prop_vals AS prop
WHERE ifNull(notEquals(prop, []), isNotNull(prop)
or isNotNull([])))
(SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,
if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,
e.uuid AS uuid,
e.`$session_id` AS `$session_id`,
e.`$window_id` AS `$window_id`,
if(equals(e.event, 'sign up'), 1, 0) AS step_0,
if(and(equals(e.event, 'buy'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$version'), ''), 'null'), '^"|"$', ''), 'xyz'), 0)), 1, 0) AS step_1,
[ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', '')), '')] AS prop_basic,
if(ifNull(equals(step_0, 1), 0), prop_basic, []) AS prop_0,
if(ifNull(equals(step_1, 1), 0), prop_basic, []) AS prop_1,
prop_1 AS prop,
groupUniqArray(prop) OVER (PARTITION BY aggregation_target) AS prop_vals
FROM events AS e
LEFT OUTER JOIN
(SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)
WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), toDateTime64('2020-01-08 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('buy', 'sign up'))), or(ifNull(equals(step_0, 1), 0), ifNull(equals(step_1, 1), 0))))
GROUP BY aggregation_target
HAVING ifNull(greaterOrEquals(step_reached, 0), 0))
GROUP BY breakdown
@@ -854,11 +839,12 @@
if(ifNull(less(row_number, 25), 0), breakdown, ['Other']) AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,
arrayJoin(aggregate_funnel_array_v3(2, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
arrayJoin(aggregate_funnel_array_v4(2, 1209600, 'first_touch', 'ordered', groupUniqArrayIf(prop, ifNull(notEquals(prop, []), isNotNull(prop)
or isNotNull([]))), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
and isNull(x_after.3)), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,
af_tuple.1 AS step_reached,
plus(af_tuple.1, 1) AS steps,
af_tuple.2 AS breakdown,
@@ -933,7 +919,7 @@
if(ifNull(less(row_number, 25), 0), breakdown, 'Other') AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1015,7 +1001,7 @@
if(ifNull(less(row_number, 25), 0), breakdown, 'Other') AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1097,7 +1083,7 @@
if(ifNull(less(row_number, 25), 0), breakdown, 'Other') AS final_prop
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1174,7 +1160,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1254,7 +1240,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1334,7 +1320,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)
@@ -1414,7 +1400,7 @@
actor_id AS id
FROM
(SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, prop, arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,
arrayJoin(aggregate_funnel_v3(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
arrayJoin(aggregate_funnel_v4(3, 1209600, 'first_touch', 'ordered', groupUniqArray(prop), arrayFilter((x, x_before, x_after) -> not(and(ifNull(lessOrEquals(length(x.4), 1), 0), ifNull(equals(x.4, x_before.4), isNull(x.4)
and isNull(x_before.4)), ifNull(equals(x.4, x_after.4), isNull(x.4)
and isNull(x_after.4)), ifNull(equals(x.3, x_before.3), isNull(x.3)
and isNull(x_before.3)), ifNull(equals(x.3, x_after.3), isNull(x.3)

View File

@@ -1478,583 +1478,6 @@
allow_experimental_analyzer=1
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.10
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.11
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.12
'''
SELECT aggregation_target AS actor_id
FROM
(SELECT aggregation_target,
steps,
avg(step_1_conversion_time) step_1_average_conversion_time_inner,
avg(step_2_conversion_time) step_2_average_conversion_time_inner,
median(step_1_conversion_time) step_1_median_conversion_time_inner,
median(step_2_conversion_time) step_2_median_conversion_time_inner,
prop
FROM
(SELECT aggregation_target,
steps,
max(steps) over (PARTITION BY aggregation_target,
prop) as max_steps,
step_1_conversion_time,
step_2_conversion_time,
prop
FROM
(SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'sign up', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'play movie', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'buy', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1
UNION ALL SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'play movie', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'buy', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'sign up', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1
UNION ALL SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'buy', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'sign up', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'play movie', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1 ))
GROUP BY aggregation_target,
steps,
prop
HAVING steps = max(max_steps))
WHERE steps IN [1, 2, 3]
AND arrayFlatten(array(prop)) = arrayFlatten(array('technology'))
ORDER BY aggregation_target
LIMIT 100
OFFSET 0 SETTINGS max_ast_elements=1000000,
max_expanded_ast_elements=1000000
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.13
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.14
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.15
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.16
'''
SELECT aggregation_target AS actor_id
FROM
(SELECT aggregation_target,
steps,
avg(step_1_conversion_time) step_1_average_conversion_time_inner,
avg(step_2_conversion_time) step_2_average_conversion_time_inner,
median(step_1_conversion_time) step_1_median_conversion_time_inner,
median(step_2_conversion_time) step_2_median_conversion_time_inner,
prop
FROM
(SELECT aggregation_target,
steps,
max(steps) over (PARTITION BY aggregation_target,
prop) as max_steps,
step_1_conversion_time,
step_2_conversion_time,
prop
FROM
(SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'sign up', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'play movie', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'buy', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1
UNION ALL SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'play movie', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'buy', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'sign up', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1
UNION ALL SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'buy', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'sign up', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'play movie', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1 ))
GROUP BY aggregation_target,
steps,
prop
HAVING steps = max(max_steps))
WHERE steps IN [2, 3]
AND arrayFlatten(array(prop)) = arrayFlatten(array('technology'))
ORDER BY aggregation_target
LIMIT 100
OFFSET 0 SETTINGS max_ast_elements=1000000,
max_expanded_ast_elements=1000000
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.2
'''
SELECT source.id,
@@ -2832,326 +2255,3 @@
allow_experimental_analyzer=1
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.5
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.6
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.7
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.8
'''
SELECT aggregation_target AS actor_id
FROM
(SELECT aggregation_target,
steps,
avg(step_1_conversion_time) step_1_average_conversion_time_inner,
avg(step_2_conversion_time) step_2_average_conversion_time_inner,
median(step_1_conversion_time) step_1_median_conversion_time_inner,
median(step_2_conversion_time) step_2_median_conversion_time_inner,
prop
FROM
(SELECT aggregation_target,
steps,
max(steps) over (PARTITION BY aggregation_target,
prop) as max_steps,
step_1_conversion_time,
step_2_conversion_time,
prop
FROM
(SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'sign up', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'play movie', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'buy', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1
UNION ALL SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'play movie', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'buy', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'sign up', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1
UNION ALL SELECT *,
arraySort([latest_0,latest_1,latest_2]) as event_times,
arraySum([if(latest_0 < latest_1 AND latest_1 <= latest_0 + INTERVAL 7 DAY, 1, 0),if(latest_0 < latest_2 AND latest_2 <= latest_0 + INTERVAL 7 DAY, 1, 0), 1]) AS steps ,
arraySort([latest_0,latest_1,latest_2]) as conversion_times,
if(isNotNull(conversion_times[2])
AND conversion_times[2] <= conversion_times[1] + INTERVAL 7 DAY, dateDiff('second', conversion_times[1], conversion_times[2]), NULL) step_1_conversion_time,
if(isNotNull(conversion_times[3])
AND conversion_times[3] <= conversion_times[2] + INTERVAL 7 DAY, dateDiff('second', conversion_times[2], conversion_times[3]), NULL) step_2_conversion_time
FROM
(SELECT aggregation_target, timestamp, step_0,
latest_0,
step_1,
min(latest_1) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_1,
step_2,
min(latest_2) over (PARTITION by aggregation_target,
prop
ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING) latest_2 ,
if(has(['technology', 'finance'], prop), prop, 'Other') as prop
FROM
(SELECT *,
prop_vals as prop
FROM
(SELECT e.timestamp as timestamp,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as aggregation_target,
if(notEmpty(pdi.distinct_id), pdi.person_id, e.person_id) as person_id,
if(event = 'buy', 1, 0) as step_0,
if(step_0 = 1, timestamp, null) as latest_0,
if(event = 'sign up', 1, 0) as step_1,
if(step_1 = 1, timestamp, null) as latest_1,
if(event = 'play movie', 1, 0) as step_2,
if(step_2 = 1, timestamp, null) as latest_2,
replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS prop_basic,
prop_basic as prop,
argMinIf(prop, timestamp, isNotNull(prop)) over (PARTITION by aggregation_target) as prop_vals
FROM events e
LEFT OUTER JOIN
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 99999
AND distinct_id IN
(SELECT distinct_id
FROM events
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC') )
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
AND (step_0 = 1
OR step_1 = 1
OR step_2 = 1) )))
WHERE step_0 = 1 ))
GROUP BY aggregation_target,
steps,
prop
HAVING steps = max(max_steps))
WHERE steps IN [2, 3]
AND arrayFlatten(array(prop)) = arrayFlatten(array('finance'))
ORDER BY aggregation_target
LIMIT 100
OFFSET 0 SETTINGS max_ast_elements=1000000,
max_expanded_ast_elements=1000000
'''
# ---
# name: TestUnorderedFunnelGroupBreakdown.test_funnel_breakdown_group.9
'''
SELECT replaceRegexpAll(JSONExtractRaw(group_properties_0, 'industry'), '^"|"$', '') AS value,
count(*) as count
FROM events e
LEFT JOIN
(SELECT group_key,
argMax(group_properties, _timestamp) AS group_properties_0
FROM groups
WHERE team_id = 99999
AND group_type_index = 0
GROUP BY group_key) groups_0 ON "$group_0" == groups_0.group_key
WHERE team_id = 99999
AND event IN ['buy', 'play movie', 'sign up']
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
GROUP BY value
ORDER BY count DESC, value DESC
LIMIT 26
OFFSET 0
'''
# ---

View File

@@ -4576,6 +4576,95 @@ def funnel_test_factory(Funnel, event_factory, person_factory):
self.assertEqual(0, results[0]["count"])
self.assertEqual(0, results[1]["count"])
def test_breakdown_step_attributions(self):
events = [
{
"event": "step one",
"properties": {"$browser": "Chrome"},
"timestamp": datetime(2021, 5, 1, 0, 0, 0),
},
{
"event": "step two",
"timestamp": datetime(2021, 5, 1, 0, 0, 1),
"properties": {"$browser": "Safari"},
},
{
"event": "step two",
"timestamp": datetime(2021, 5, 1, 0, 0, 2),
"properties": {"$browser": "Chrome"},
},
{
"event": "step three",
"timestamp": datetime(2021, 5, 1, 0, 0, 3),
"properties": {"$browser": "Chrome"},
},
]
journeys_for(
{
"user_one": events,
},
self.team,
)
filters = {
"insight": INSIGHT_FUNNELS,
"funnel_viz_type": "steps",
"date_from": "2021-05-01 00:00:00",
"date_to": "2021-05-02 23:59:59",
"funnel_window_interval": 30,
"funnel_window_interval_unit": "second",
"events": [
{"id": "step one", "order": 0},
{"id": "step two", "order": 1},
{"id": "step three", "order": 2},
],
"breakdown_type": "event",
"breakdown": "$browser",
}
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 1 == len(results)
result = results[0]
assert 3 == len(result)
assert [x["count"] == 1 for x in result]
assert [x["breakdown"] == ["Chrome"] for x in result]
filters["breakdown_attribution_type"] = "all_events"
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 1 == len(results)
result = results[0]
assert [x["count"] for x in result] == [1, 1, 1]
assert [x["breakdown"] == ["Chrome"] for x in result]
filters["breakdown_attribution_type"] = "step"
filters["breakdown_attribution_value"] = 0
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 1 == len(results)
result = results[0]
assert [x["count"] for x in result] == [1, 1, 1]
assert [x["breakdown"] == ["Chrome"] for x in result]
filters["breakdown_attribution_type"] = "step"
filters["breakdown_attribution_value"] = 1
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 2 == len(results)
for result in results:
assert [x["count"] for x in result] == [1, 1, 1]
filters["breakdown_attribution_type"] = "step"
filters["breakdown_attribution_value"] = 2
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 1 == len(results)
result = results[0]
assert [x["count"] for x in result] == [1, 1, 1]
assert [x["breakdown"] == ["Chrome"] for x in result]
return TestGetFunnel

View File

@@ -2342,6 +2342,205 @@ class BaseTestFunnelTrends(ClickhouseTestMixin, APIBaseTest):
self.assertEqual(0, results[0]["reached_from_step_count"])
self.assertEqual(0, results[0]["reached_to_step_count"])
def test_breakdown_with_attribution(self):
events = [
{
"event": "step one",
"properties": {"$browser": "Chrome"},
"timestamp": datetime(2021, 5, 1, 0, 0, 0),
},
{
"event": "step one",
"properties": {"$browser": "Safari"},
"timestamp": datetime(2021, 5, 1, 0, 0, 1),
},
{
"event": "step two",
"timestamp": datetime(2021, 5, 1, 0, 0, 14),
"properties": {"$browser": "Chrome"},
},
{
"event": "step one",
"properties": {"$browser": "Chrome"},
"timestamp": datetime(2021, 5, 2, 0, 0, 0),
},
{
"event": "step two",
"properties": {"$browser": "Safari"},
"timestamp": datetime(2021, 5, 2, 0, 0, 1),
},
{
"event": "step two",
"timestamp": datetime(2021, 5, 2, 0, 0, 14),
"properties": {"$browser": "Chrome"},
},
]
journeys_for(
{
"user_one": events,
},
self.team,
)
filters = {
"insight": INSIGHT_FUNNELS,
"funnel_viz_type": "trends",
"interval": "day",
"date_from": "2021-05-01 00:00:00",
"date_to": "2021-05-02 23:59:59",
"funnel_window_interval": 30,
"funnel_window_interval_unit": "second",
"events": [
{"id": "step one", "order": 0},
{"id": "step two", "order": 1},
],
"breakdown_type": "event",
"breakdown": "$browser",
}
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 2 == len(results)
assert [1, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 1] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
filters["breakdown_attribution_type"] = "all_events"
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 4 == len(results)
assert [1, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 1] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 0] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
assert [0, 0] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
filters["breakdown_attribution_type"] = "step"
filters["breakdown_attribution_value"] = 0
query = cast(FunnelsQuery, filter_to_query(filters))
full_results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate()
results = full_results.results
# Normal funnels fail on this
if full_results.isUdf:
assert 4 == len(results)
assert [1, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 1] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 0] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
assert [1, 0] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
filters["breakdown_attribution_type"] = "step"
filters["breakdown_attribution_value"] = 1
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 4 == len(results)
assert [1, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 1] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
assert [0, 1] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
def test_breakdown_with_attribution_2(self):
events = [
{
"event": "step one",
"properties": {"$browser": "Chrome"},
"timestamp": datetime(2021, 5, 1, 0, 0, 0),
},
{
"event": "step two",
"timestamp": datetime(2021, 5, 1, 0, 0, 1),
"properties": {"$browser": "Chrome"},
},
{
"event": "step three",
"timestamp": datetime(2021, 5, 1, 0, 0, 2),
"properties": {"$browser": "Safari"},
},
{
"event": "step one",
"properties": {"$browser": "Safari"},
"timestamp": datetime(2021, 5, 2, 0, 0, 0),
},
{
"event": "step two",
"timestamp": datetime(2021, 5, 2, 0, 0, 1),
"properties": {"$browser": "Safari"},
},
{
"event": "step three",
"timestamp": datetime(2021, 5, 2, 0, 0, 2),
"properties": {"$browser": "Chrome"},
},
]
journeys_for(
{
"user_one": events,
},
self.team,
)
filters = {
"insight": INSIGHT_FUNNELS,
"funnel_viz_type": "trends",
"interval": "day",
"date_from": "2021-05-01 00:00:00",
"date_to": "2021-05-02 23:59:59",
"funnel_window_interval": 30,
"funnel_window_interval_unit": "second",
"events": [
{"id": "step one", "order": 0},
{"id": "step two", "order": 1},
{"id": "step three", "order": 2},
],
"breakdown_type": "event",
"breakdown": "$browser",
"funnel_from_step": 0,
"funnel_to_step": 2,
}
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 2 == len(results)
assert [1, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 1] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
filters["breakdown_attribution_type"] = "all_events"
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 4 == len(results)
assert [1, 0] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [0, 0] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [0, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
assert [0, 0] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
filters["breakdown_attribution_type"] = "step"
filters["breakdown_attribution_value"] = 0
query = cast(FunnelsQuery, filter_to_query(filters))
full_results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate()
results = full_results.results
if full_results.isUdf:
assert 4 == len(results)
assert [1, 0] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 0] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [0, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
assert [0, 1] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
filters["breakdown_attribution_type"] = "step"
filters["breakdown_attribution_value"] = 2
query = cast(FunnelsQuery, filter_to_query(filters))
results = FunnelsQueryRunner(query=query, team=self.team, just_summarize=True).calculate().results
assert 4 == len(results)
assert [1, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [0, 1] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Chrome"]]
assert [1, 1] == [x["reached_from_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
assert [1, 0] == [x["reached_to_step_count"] for x in results if x["breakdown_value"] == ["Safari"]]
class TestFunnelTrends(BaseTestFunnelTrends):
__test__ = True

View File

@@ -704,7 +704,7 @@ class QueryRunner(ABC, Generic[Q, R, CR]):
# TODO: add support for selecting and filtering by breakdowns
raise NotImplementedError()
def to_hogql(self) -> str:
def to_hogql(self, **kwargs) -> str:
with self.timings.measure("to_hogql"):
return print_ast(
self.to_query(),
@@ -715,6 +715,7 @@ class QueryRunner(ABC, Generic[Q, R, CR]):
modifiers=self.modifiers,
),
"hogql",
**kwargs,
)
def get_cache_payload(self) -> dict:

View File

@@ -13,10 +13,10 @@ from xml import etree
# 4. Land a version of the posthog repo with the updated `user_scripts` folder from the new branch (make sure this PR doesn't include changes to this file with the new version)
# 5. Run the `copy_udfs_to_clickhouse` action in the `posthog_cloud_infra` repo to deploy the `user_scripts` folder to clickhouse
# 6. After that deploy goes out, it is safe to land and deploy the full changes to the `posthog` repo
UDF_VERSION = 3 # Last modified by: @aspicer, 2024-10-30
UDF_VERSION = 4 # Last modified by: @aspicer, 2024-12-6
# Clean up all versions less than this
EARLIEST_UDF_VERSION = 2
EARLIEST_UDF_VERSION = 3
CLICKHOUSE_XML_FILENAME = "user_defined_function.xml"
ACTIVE_XML_CONFIG = "../../docker/clickhouse/user_defined_function.xml"

View File

@@ -1,299 +1,6 @@
<functions>
<!-- Version: v3. Generated at: 2024-10-30T21:06:46.087998+00:00
<!-- Version: v4. Generated at: 2024-12-10T05:06:27.315812+00:00
This file is autogenerated by udf_versioner.py. Do not edit this, only edit the version at docker/clickhouse/user_defined_function.xml--><function>
<type>executable_pool</type>
<name>aggregate_funnel_v2</name>
<return_type>Array(Tuple(Int8, Nullable(String), Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Nullable(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v2/aggregate_funnel steps</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_cohort_v2</name>
<return_type>Array(Tuple(Int8, UInt64, Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(UInt64)</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UUID, UInt64, Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v2/aggregate_funnel steps</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_array_v2</name>
<return_type>Array(Tuple(Int8, Array(String), Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Array(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v2/aggregate_funnel steps</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_test_v2</name>
<return_type>String</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Array(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v2/aggregate_funnel_test.py</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_trends_v2</name>
<return_type>Array(Tuple(UInt64, Int8, Nullable(String), UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>from_step</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Nullable(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v2/aggregate_funnel trends</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_array_trends_v2</name>
<return_type>Array(Tuple(UInt64, Int8, Array(String), UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>from_step</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Array(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v2/aggregate_funnel trends</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_cohort_trends_v2</name>
<return_type>Array(Tuple(UInt64, Int8, UInt64, UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>from_step</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(UInt64)</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, UInt64, Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v2/aggregate_funnel trends</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_array_trends_test_v2</name>
<return_type>String</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>from_step</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Array(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v2/aggregate_funnel_array_trends_test.py</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_v3</name>
<return_type>Array(Tuple(Int8, Nullable(String), Array(Float64), Array(Array(UUID))))</return_type>
@@ -586,4 +293,297 @@ This file is autogenerated by udf_versioner.py. Do not edit this, only edit the
<command>v3/aggregate_funnel_array_trends_test.py</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_v4</name>
<return_type>Array(Tuple(Int8, Nullable(String), Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Nullable(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v4/aggregate_funnel steps</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_cohort_v4</name>
<return_type>Array(Tuple(Int8, UInt64, Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(UInt64)</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UUID, UInt64, Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v4/aggregate_funnel steps</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_array_v4</name>
<return_type>Array(Tuple(Int8, Array(String), Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Array(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v4/aggregate_funnel steps</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_test_v4</name>
<return_type>String</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Array(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v4/aggregate_funnel_test.py</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_trends_v4</name>
<return_type>Array(Tuple(UInt64, Int8, Nullable(String), UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>from_step</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Nullable(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v4/aggregate_funnel trends</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_array_trends_v4</name>
<return_type>Array(Tuple(UInt64, Int8, Array(String), UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>from_step</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Array(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v4/aggregate_funnel trends</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_cohort_trends_v4</name>
<return_type>Array(Tuple(UInt64, Int8, UInt64, UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>from_step</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(UInt64)</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, UInt64, Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v4/aggregate_funnel trends</command>
<lifetime>600</lifetime>
</function>
<function>
<type>executable_pool</type>
<name>aggregate_funnel_array_trends_test_v4</name>
<return_type>String</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
<name>from_step</name>
</argument>
<argument>
<type>UInt8</type>
<name>num_steps</name>
</argument>
<argument>
<type>UInt64</type>
<name>conversion_window_limit</name>
</argument>
<argument>
<type>String</type>
<name>breakdown_attribution_type</name>
</argument>
<argument>
<type>String</type>
<name>funnel_order_type</name>
</argument>
<argument>
<type>Array(Array(String))</type>
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>v4/aggregate_funnel_array_trends_test.py</command>
<lifetime>600</lifetime>
</function>
</functions>