Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(experiments): keep pre-cutoff experiments counting exposures (#114399)

Anders28db881f687b
diff --git a/products/experiments/backend/hogql_queries/experiment_exposure_query_builder.py b/products/experiments/backend/hogql_queries/experiment_exposure_query_builder.py
index 107902d150a9..a3974b153364 100644
--- a/products/experiments/backend/hogql_queries/experiment_exposure_query_builder.py
+++ b/products/experiments/backend/hogql_queries/experiment_exposure_query_builder.py
@@ -11,6 +11,7 @@ from products.experiments.backend.hogql_queries.experiment_query_context import
from products.experiments.backend.hogql_queries.exposure_query_logic import (
DEFAULT_EXPOSURE_EVENT,
EXPERIMENT_EXPOSURE_EVENT,
+ exposure_event_name_filter,
)
@@ -221,28 +222,38 @@ class ExposureQueryBuilder:
def build_exposure_event_predicate(self) -> ast.Expr:
"""Event-level exposure predicate, without date, variant, or test-account conditions."""
- event_predicate = event_or_action_to_filter(self.context.team, self.context.exposure_config)
+ exposure_config = self.context.exposure_config
+ if not (
+ isinstance(exposure_config, ExperimentEventExposureConfig)
+ and exposure_config.event in (DEFAULT_EXPOSURE_EVENT, EXPERIMENT_EXPOSURE_EVENT)
+ ):
+ return event_or_action_to_filter(self.context.team, exposure_config)
- # $feature_flag_called and $experiment_exposure are not specific to one flag, so without the
- # flag key filter, exposures of other experiments would count too.
- if isinstance(
- self.context.exposure_config, ExperimentEventExposureConfig
- ) and self.context.exposure_config.event in (DEFAULT_EXPOSURE_EVENT, EXPERIMENT_EXPOSURE_EVENT):
- flag_property = f"$feature_flag"
+ event_predicate = exposure_event_name_filter(
+ exposure_config.event, read_copies=self.context.read_exposure_copies
+ )
+ if exposure_config.properties:
event_predicate = ast.And(
exprs=[
event_predicate,
- parse_expr(
- "{flag_property} = {feature_flag_key}",
- placeholders={
- "flag_property": ast.Field(chain=["properties", flag_property]),
- "feature_flag_key": ast.Constant(value=self.context.feature_flag_key),
- },
- ),
+ ast.And(exprs=[property_to_expr(prop, self.context.team) for prop in exposure_config.properties]),
]
)
- return event_predicate
+ # $feature_flag_called and $experiment_exposure are not specific to one flag, so without the
+ # flag key filter, exposures of other experiments would count too.
+ return ast.And(
+ exprs=[
+ event_predicate,
+ parse_expr(
+ "{flag_property} = {feature_flag_key}",
+ placeholders={
+ "flag_property": ast.Field(chain=["properties", "$feature_flag"]),
+ "feature_flag_key": ast.Constant(value=self.context.feature_flag_key),
+ },
+ ),
+ ]
+ )
def build_entity_key_filter(self) -> ast.Expr:
"""
diff --git a/products/experiments/backend/hogql_queries/experiment_query_builder.py b/products/experiments/backend/hogql_queries/experiment_query_builder.py
index ba926e10742b..11e10801f32f 100644
--- a/products/experiments/backend/hogql_queries/experiment_query_builder.py
+++ b/products/experiments/backend/hogql_queries/experiment_query_builder.py
@@ -1,3 +1,4 @@
+from collections.abc import Sequence
from dataclasses import dataclass
from datetime import datetime
from typing import Optional, Union
@@ -7,6 +8,7 @@ from django.utils import timezone
from posthog.schema import (
ActionsNode,
Breakdown,
+ EventsNode,
ExperimentEventExposureConfig,
ExperimentExposureCriteria,
ExperimentFunnelMetric,
@@ -22,6 +24,7 @@ from posthog.hogql.constants import MAX_SELECT_RETURNED_ROWS
from posthog.hogql_queries.utils.query_date_range import QueryDateRange
from posthog.models.team.team import Team
+from products.actions.backend.models.action import Action
from products.experiments.backend.hogql_queries.breakdown_injector import BreakdownInjector
from products.experiments.backend.hogql_queries.cuped_config import CupedQueryConfig
from products.experiments.backend.hogql_queries.experiment_cuped_query_builder import CupedQueryBuilder
@@ -117,6 +120,30 @@ def get_exposure_config_params_for_builder(
)
+def metric_reads_flag_call(
+ team: Team,
+ metric: ExperimentMeanMetric | ExperimentFunnelMetric | ExperimentRatioMetric | ExperimentRetentionMetric,
+) -> bool:
+ """Whether a metric source matches $feature_flag_called, as its event or through an action step."""
+ sources: Sequence[object]
+ if isinstance(metric, ExperimentMeanMetric):
+ sources = [metric.source]
+ elif isinstance(metric, ExperimentFunnelMetric):
+ sources = metric.series
+ elif isinstance(metric, ExperimentRatioMetric):
+ sources = [metric.numerator, metric.denominator]
+ else:
+ sources = [metric.start_event, metric.completion_event]
+ if any(isinstance(source, EventsNode) and source.event == DEFAULT_EXPOSURE_EVENT for source in sources):
+ return True
+ action_ids = [int(source.id) for source in sources if isinstance(source, ActionsNode)]
+ return bool(action_ids) and any(
+ step.event == DEFAULT_EXPOSURE_EVENT
+ for action in Action.objects.filter(pk__in=action_ids, team__project_id=team.project_id)
+ for step in action.steps
+ )
+
+
class ExperimentQueryBuilder:
def __init__(
self,
@@ -173,6 +200,7 @@ class ExperimentQueryBuilder:
only_count_matured_users=self.only_count_matured_users,
cuped_config=self.cuped_config,
activation_config=self.activation_config,
+ read_exposure_copies=metric is None or not metric_reads_flag_call(team, metric),
)
# Experiment queries group by (variant, breakdown_values), so the row count is
diff --git a/products/experiments/backend/hogql_queries/experiment_query_context.py b/products/experiments/backend/hogql_queries/experiment_query_context.py
index b0451f3f7e4e..f129275a1d4f 100644
--- a/products/experiments/backend/hogql_queries/experiment_query_context.py
+++ b/products/experiments/backend/hogql_queries/experiment_query_context.py
@@ -35,6 +35,10 @@ class ExperimentQueryContext:
# When set, an entity only counts as exposed once it emits this event at/after its first
# default exposure event, and that activation event's timestamp becomes the exposure time.
activation_config: ExperimentEventExposureConfig | ActionsNode | None = None
+ # Whether an exposure on $feature_flag_called also reads its $experiment_exposure copy. It is
+ # False for a metric that reads $feature_flag_called: the call and its copy share a timestamp,
+ # so one of them would be the exposure and the other a conversion.
+ read_exposure_copies: bool = True
@dataclass(frozen=True)
diff --git a/products/experiments/backend/hogql_queries/exposure_query_logic.py b/products/experiments/backend/hogql_queries/exposure_query_logic.py
index c19db9d18858..807f273c8cfb 100644
--- a/products/experiments/backend/hogql_queries/exposure_query_logic.py
+++ b/products/experiments/backend/hogql_queries/exposure_query_logic.py
@@ -37,8 +37,9 @@ EXPERIMENT_EXPOSURE_EVENT_FLAG = "experiment-exposure-event"
# The start of $experiment_exposure ingestion. Experiments started before this timestamp ran
# (at least partly) without $experiment_exposure, so they must keep counting exposures via
-# $feature_flag_called even where the two overlap. Only experiments whose start_date is at or
-# after the cutoff can rely on $experiment_exposure covering their whole exposure window.
+# $feature_flag_called, and read the $experiment_exposure copy next to it
+# (exposure_event_name_filter). Only experiments whose start_date is at or after the cutoff can
+# rely on $experiment_exposure covering their whole exposure window.
EXPERIMENT_EXPOSURE_EVENT_CUTOFF = datetime(2026, 9, 1, tzinfo=UTC)
@@ -47,9 +48,10 @@ def resolve_default_exposure_event(team: Team, start_date: Optional[datetime]) -
Returns the event to count exposures on when the experiment doesn't configure a custom one.
Experiments started at or after EXPERIMENT_EXPOSURE_EVENT_CUTOFF use $experiment_exposure,
- provided the team is flagged into the rollout. Everything else stays on $feature_flag_called:
- older experiments predate the new event, and because ingestion duplicates flag events into
- $experiment_exposure, counting exactly one of the two is what avoids double counting.
+ provided the team is flagged into the rollout. Everything else resolves to
+ $feature_flag_called, because older experiments predate the new event. The exposure filters
+ read $feature_flag_called together with its $experiment_exposure copy (see
+ exposure_event_name_filter).
"""
if start_date is None:
return DEFAULT_EXPOSURE_EVENT
@@ -74,6 +76,29 @@ def resolve_default_exposure_event(team: Team, start_date: Optional[datetime]) -
return EXPERIMENT_EXPOSURE_EVENT if enabled else DEFAULT_EXPOSURE_EVENT
+def exposure_event_name_filter(event: str, *, read_copies: bool = True) -> ast.Expr:
+ """Matches the events that carry exposures for a resolved exposure event.
+
+ An experiment on $feature_flag_called also reads $experiment_exposure, unless `read_copies`
+ is False. Ingestion stops writing $feature_flag_called to events for an organization on
+ FLAG_EVALUATIONS_ONLY. For a team whose flag calls ingestion copies, the $experiment_exposure
+ copy then carries the exposures. Before that, a call and its copy are two rows for one
+ exposure. Every exposure read aggregates per entity (first exposure time, variant), so the two
+ rows give the same result as one.
+ """
+ if event == DEFAULT_EXPOSURE_EVENT and read_copies:
+ return ast.CompareOperation(
+ op=ast.CompareOperationOp.In,
+ left=ast.Field(chain=["event"]),
+ right=ast.Constant(value=[DEFAULT_EXPOSURE_EVENT, EXPERIMENT_EXPOSURE_EVENT]),
+ )
+ return ast.CompareOperation(
+ op=ast.CompareOperationOp.Eq,
+ left=ast.Field(chain=["event"]),
+ right=ast.Constant(value=event),
+ )
+
+
# What a new experiment filters test accounts by when its criteria don't say. It does not follow
# Team.test_account_filters_default_checked: most projects leave that field null, while nearly
# every experiment stores filterTestAccounts true.
@@ -294,13 +319,7 @@ def _build_event_filters(
return [_build_action_filter(int(exposure_config.id), team)]
event = _get_event_name_from_config(exposure_config, default_exposure_event)
- filters: list[ast.Expr] = [
- ast.CompareOperation(
- op=ast.CompareOperationOp.Eq,
- left=ast.Field(chain=["event"]),
- right=ast.Constant(value=event),
- )
- ]
+ filters: list[ast.Expr] = [exposure_event_name_filter(event)]
# $feature_flag_called and $experiment_exposure are not specific to one flag, so without the
# flag key filter, exposures of other experiments would count too.
diff --git a/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_actors_query.ambr b/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_actors_query.ambr
index 0c623763429b..f67f7d055b8e 100644
--- a/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_actors_query.ambr
+++ b/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_actors_query.ambr
@@ -20,7 +20,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id) SELECT exposures.entity_id AS actor_id,
exposures.variant AS variant,
array(tuple(toTimeZone(exposures.first_exposure_time, 'UTC'), exposures.exposure_event_uuid, exposures.exposure_session_id, '')) AS matching_events,
@@ -90,7 +90,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id) SELECT exposures.entity_id AS actor_id,
exposures.variant AS variant,
actor_id AS id
@@ -135,7 +135,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id) SELECT exposures.entity_id AS actor_id,
exposures.variant AS variant,
actor_id AS id
@@ -180,14 +180,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -198,7 +198,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -252,14 +252,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -270,7 +270,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -324,14 +324,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -342,7 +342,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -396,14 +396,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -414,7 +414,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -468,14 +468,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -486,7 +486,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -540,14 +540,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -558,7 +558,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -612,14 +612,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -630,7 +630,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -684,14 +684,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -702,7 +702,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -756,14 +756,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -774,7 +774,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -828,14 +828,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -846,7 +846,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -901,14 +901,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -919,7 +919,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
diff --git a/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_actors_query.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_actors_query.new_events_schema.ambr
index ce37edace53a..c61eedad0853 100644
--- a/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_actors_query.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_actors_query.new_events_schema.ambr
@@ -20,7 +20,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id) SELECT exposures.entity_id AS actor_id,
exposures.variant AS variant,
array(tuple(toTimeZone(exposures.first_exposure_time, 'UTC'), exposures.exposure_event_uuid, exposures.exposure_session_id, '')) AS matching_events,
@@ -68,7 +68,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id) SELECT exposures.entity_id AS actor_id,
exposures.variant AS variant,
actor_id AS id
@@ -115,7 +115,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id) SELECT exposures.entity_id AS actor_id,
exposures.variant AS variant,
actor_id AS id
@@ -162,14 +162,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -180,7 +180,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -236,14 +236,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -254,7 +254,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -310,14 +310,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -328,7 +328,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -384,14 +384,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -402,7 +402,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -458,14 +458,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -476,7 +476,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -532,14 +532,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -550,7 +550,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -606,14 +606,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -624,7 +624,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -680,14 +680,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -698,7 +698,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -754,14 +754,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -772,7 +772,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -828,14 +828,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -846,7 +846,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -903,14 +903,14 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- multiply(1, and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
+ multiply(1, and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0))) AS step_0,
if(equals(events.event, 'signup'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -921,7 +921,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), or(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), or(equals(events.event, 'signup'), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
diff --git a/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_query_builder.ambr b/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_query_builder.ambr
index 9f6a72be0421..70d9a12f81b8 100644
--- a/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_query_builder.ambr
+++ b/products/experiments/backend/hogql_queries/test/__snapshots__/test_experiment_query_builder.ambr
@@ -24,7 +24,7 @@
if(greater(uniqExact(properties.$feature_flag_response), 1), '$multiple', any(properties.$feature_flag_response)) AS variant,
toDate(toString(min(timestamp))) AS day
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -48,7 +48,7 @@
if(greater(uniqExact(properties.$feature_flag_response), 1), '$multiple', any(properties.$feature_flag_response)) AS variant,
min(timestamp) AS first_flag_exposure_time
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id) AS flag_exposures ON equals(person_id, flag_exposures.entity_id)
WHERE and(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), equals(event, 'signed_up'), notILike(toString(person.properties.email), '%@posthog.com%')), greaterOrEquals(timestamp, flag_exposures.first_flag_exposure_time))
GROUP BY entity_id)
@@ -72,12 +72,12 @@
argMin($session_id, timestamp) AS exposure_session_id,
[] AS breakdown_value
FROM events
- WHERE and(greaterOrEquals(timestamp, '__TIME_WINDOW_MIN__'), less(timestamp, '__TIME_WINDOW_MAX__'), greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, '__EXPERIMENT_DATE_TO__'), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, '__TIME_WINDOW_MIN__'), less(timestamp, '__TIME_WINDOW_MAX__'), greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, '__EXPERIMENT_DATE_TO__'), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id
'''
# ---
# name: TestExperimentQueryBuilderSnapshots.test_built_query_matches_snapshot_exposures_precompute_write.1
- '08e0e73558ee4c8e0a529a4debad2c115b644ea2ec256ebe5b337fe9dc9f0f52'
+ '8d3cae031c3db3ed052cc58b07ab25c013527a7324e761853e73006011310c58'
# ---
# name: TestExperimentQueryBuilderSnapshots.test_built_query_matches_snapshot_funnel_activation_drops_cuped
'''
@@ -94,7 +94,7 @@
if(greater(uniqExact(properties.$feature_flag_response), 1), '$multiple', any(properties.$feature_flag_response)) AS variant,
min(timestamp) AS first_flag_exposure_time
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id) AS flag_exposures ON equals(person_id, flag_exposures.entity_id)
WHERE and(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), equals(event, 'signed_up'), notILike(toString(person.properties.email), '%@posthog.com%')), greaterOrEquals(timestamp, flag_exposures.first_flag_exposure_time))
GROUP BY entity_id),
@@ -130,11 +130,11 @@
WITH base_events AS
(SELECT person_id AS entity_id,
properties.$feature_flag_response AS variant_value, timestamp, uuid,
- and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
if(equals(event, '$pageview'), 1, 0) AS step_1,
if(equals(event, 'purchase'), 1, 0) AS step_2
FROM events
- WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, minus(assumeNotNull(toDateTime('2024-01-01 00:00:00')), toIntervalDay(14))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
+ WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, minus(assumeNotNull(toDateTime('2024-01-01 00:00:00')), toIntervalDay(14))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
first_exposures AS
(SELECT entity_id,
min(timestamp) AS first_exposure_time
@@ -174,7 +174,7 @@
argMin($session_id, timestamp) AS exposure_session_id,
argMin(properties.$user_id, timestamp) AS exposure_identifier
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(properties.$user_id) AS entity_id,
@@ -182,11 +182,11 @@
timestamp AS timestamp,
uuid AS uuid,
properties.$session_id AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), 1, 0) AS step_0,
if(equals(event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events
- WHERE and(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), less(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), equals(event, '$pageview')))
+ WHERE and(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), less(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), equals(event, '$pageview')))
UNION ALL SELECT toString(userid) AS entity_id,
'' AS variant,
ds AS timestamp,
@@ -221,11 +221,11 @@
WITH base_events AS
(SELECT person_id AS entity_id,
properties.$feature_flag_response AS variant_value, timestamp, uuid,
- and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
if(equals(event, '$pageview'), 1, 0) AS step_1,
if(equals(event, 'purchase'), 1, 0) AS step_2
FROM events
- WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
+ WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
argMinIf(variant_value, timestamp, equals(step_0, 1)) AS variant,
@@ -249,11 +249,11 @@
WITH base_events AS
(SELECT person_id AS entity_id,
properties.$feature_flag_response AS variant_value, timestamp, uuid,
- and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
if(equals(event, '$pageview'), 1, 0) AS step_1,
if(equals(event, 'purchase'), 1, 0) AS step_2
FROM events
- WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, plus(assumeNotNull(toDateTime('2024-01-20 12:00:00')), toIntervalSecond(604800))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
+ WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, plus(assumeNotNull(toDateTime('2024-01-20 12:00:00')), toIntervalSecond(604800))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(variant_value, equals(step_0, 1)), 1), '$multiple', anyIf(variant_value, equals(step_0, 1))) AS variant,
@@ -277,11 +277,11 @@
WITH base_events AS
(SELECT person_id AS entity_id,
properties.$feature_flag_response AS variant_value, timestamp, uuid,
- and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
if(equals(event, '$pageview'), 1, 0) AS step_1,
if(equals(event, 'purchase'), 1, 0) AS step_2
FROM events
- WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, plus(assumeNotNull(toDateTime('2024-01-20 12:00:00')), toIntervalSecond(604800))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
+ WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, plus(assumeNotNull(toDateTime('2024-01-20 12:00:00')), toIntervalSecond(604800))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(variant_value, equals(step_0, 1)), 1), '$multiple', anyIf(variant_value, equals(step_0, 1))) AS variant,
@@ -305,11 +305,11 @@
WITH base_events AS
(SELECT person_id AS entity_id,
properties.$feature_flag_response AS variant_value, timestamp, uuid,
- and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
if(equals(event, '$pageview'), 1, 0) AS step_1,
if(equals(event, 'purchase'), 1, 0) AS step_2
FROM events
- WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
+ WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(variant_value, equals(step_0, 1)), 1), '$multiple', anyIf(variant_value, equals(step_0, 1))) AS variant,
@@ -334,15 +334,15 @@
timestamp AS timestamp,
uuid AS event_uuid,
$session_id AS session_id,
- [_toUInt8(if(and(and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), 1, 0)),
+ [_toUInt8(if(and(and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), 1, 0)),
_toUInt8(if(equals(event, '$pageview'), 1, 0)),
_toUInt8(if(equals(event, 'purchase'), 1, 0))] AS steps
FROM events
- WHERE and(greaterOrEquals(timestamp, '__TIME_WINDOW_MIN__'), less(timestamp, '__TIME_WINDOW_MAX__'), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, '__EXPERIMENT_DATE_TO__'), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, plus('__EXPERIMENT_DATE_TO__', toIntervalSecond(604800))), or(equals(event, '$pageview'), equals(event, 'purchase')))))
+ WHERE and(greaterOrEquals(timestamp, '__TIME_WINDOW_MIN__'), less(timestamp, '__TIME_WINDOW_MAX__'), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, '__EXPERIMENT_DATE_TO__'), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, plus('__EXPERIMENT_DATE_TO__', toIntervalSecond(604800))), or(equals(event, '$pageview'), equals(event, 'purchase')))))
'''
# ---
# name: TestExperimentQueryBuilderSnapshots.test_built_query_matches_snapshot_funnel_precompute_write.1
- '6307e2ad5206d6cbdc8881bea666f3c24090e5f826ae2acc79b9a254d9fd0ace'
+ '99b0aa3d82a91602b532e3fbcde19359a8f566487aac41f3600327eea84aa2dc'
# ---
# name: TestExperimentQueryBuilderSnapshots.test_built_query_matches_snapshot_funnel_precomputed
'''
@@ -399,11 +399,11 @@
metric_events AS
(SELECT person_id AS entity_id,
properties.$feature_flag_response AS variant, timestamp, uuid,
- and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
if(equals(event, '$pageview'), 1, 0) AS step_1,
if(equals(event, 'purchase'), 1, 0) AS step_2
FROM events
- WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, plus(assumeNotNull(toDateTime('2024-01-20 12:00:00')), toIntervalSecond(604800))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
+ WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, plus(assumeNotNull(toDateTime('2024-01-20 12:00:00')), toIntervalSecond(604800))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -428,11 +428,11 @@
WITH base_events AS
(SELECT person_id AS entity_id,
properties.$feature_flag_response AS variant_value, timestamp, uuid,
- and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])) AS step_0,
if(equals(event, '$pageview'), 1, 0) AS step_1,
if(equals(event, 'purchase'), 1, 0) AS step_2
FROM events
- WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
+ WHERE or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test'])), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), or(equals(event, '$pageview'), equals(event, 'purchase'))))),
first_exposures AS
(SELECT entity_id,
min(timestamp) AS first_exposure_time
@@ -468,7 +468,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT person_id AS entity_id,
@@ -504,7 +504,7 @@
argMin($session_id, timestamp) AS exposure_session_id,
argMin(coalesce(toString(properties.$browser), '$$_posthog_breakdown_null_$$'), timestamp) AS breakdown_value_1
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT person_id AS entity_id,
@@ -545,7 +545,7 @@
argMin($session_id, timestamp) AS exposure_session_id,
argMin(coalesce(toString(properties.$browser), '$$_posthog_breakdown_null_$$'), timestamp) AS breakdown_value_1
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT person_id AS entity_id,
@@ -585,7 +585,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT person_id AS entity_id,
@@ -625,7 +625,7 @@
argMin($session_id, timestamp) AS exposure_session_id,
argMin(properties.$user_id, timestamp) AS exposure_identifier
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT userid AS entity_id,
@@ -660,7 +660,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT person_id AS entity_id,
@@ -695,7 +695,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']), notEmpty($group_0))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']), notEmpty($group_0))
GROUP BY entity_id),
metric_events AS
(SELECT $group_0 AS entity_id,
@@ -730,7 +730,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id
HAVING lessOrEquals(plus(min(timestamp), toIntervalSecond(604800)), toDateTime('2024-01-20 12:00:00', 'UTC'))),
metric_events AS
@@ -854,7 +854,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events_by_session AS
(SELECT person_id AS entity_id,
@@ -895,7 +895,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT person_id AS entity_id,
@@ -930,7 +930,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT person_id AS entity_id,
@@ -976,7 +976,7 @@
argMin($session_id, timestamp) AS exposure_session_id,
argMin(coalesce(toString(properties.$browser), '$$_posthog_breakdown_null_$$'), timestamp) AS breakdown_value_1
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT person_id AS entity_id,
@@ -1041,7 +1041,7 @@
argMin($session_id, timestamp) AS exposure_session_id,
argMin(properties.$user_id, timestamp) AS exposure_identifier_num
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT userid AS entity_id,
@@ -1101,7 +1101,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT person_id AS entity_id,
@@ -1161,7 +1161,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT person_id AS entity_id,
@@ -1235,7 +1235,7 @@
argMin($session_id, timestamp) AS exposure_session_id,
argMin(coalesce(toString(properties.$browser), '$$_posthog_breakdown_null_$$'), timestamp) AS breakdown_value_1
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1287,7 +1287,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1335,7 +1335,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1381,7 +1381,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1427,7 +1427,7 @@
argMin(uuid, timestamp) AS exposure_event_uuid,
argMin($session_id, timestamp) AS exposure_session_id
FROM events
- WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(equals(event, '$feature_flag_called'), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
+ WHERE and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-01-20 12:00:00'))), and(in(event, ['$feature_flag_called', '$experiment_exposure']), equals(properties.$feature_flag, 'checkout-redesign')), notILike(toString(person.properties.email), '%@posthog.com%'), in(properties.$feature_flag_response, ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.ambr
index 76e6f3f59e32..80650487729b 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.ambr
@@ -25,7 +25,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, toDateTime64(flag_exposures.first_flag_exposure_time, 6, 'UTC')))
GROUP BY entity_id)
@@ -80,7 +80,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, toDateTime64(flag_exposures.first_flag_exposure_time, 6, 'UTC')))
GROUP BY entity_id),
@@ -159,7 +159,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, toDateTime64(flag_exposures.first_flag_exposure_time, 6, 'UTC')))
GROUP BY entity_id),
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.new_events_schema.ambr
index 7f05cf92da1f..77df5df15fba 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_activation_config.new_events_schema.ambr
@@ -25,7 +25,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, toDateTime64(flag_exposures.first_flag_exposure_time, 6, 'UTC')))
GROUP BY entity_id)
@@ -82,7 +82,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, toDateTime64(flag_exposures.first_flag_exposure_time, 6, 'UTC')))
GROUP BY entity_id),
@@ -163,7 +163,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id) AS flag_exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), flag_exposures.entity_id)
WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), equals(events.event, 'activated'), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1)), greaterOrEquals(events.timestamp, toDateTime64(flag_exposures.first_flag_exposure_time, 6, 'UTC')))
GROUP BY entity_id),
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.ambr
index 5795286788b6..f6b4bb7ab3e1 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -78,7 +78,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -133,7 +133,7 @@
argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
argMin(events.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
FROM events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`)))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`)))
GROUP BY entity_id),
metric_events AS
(SELECT if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`) AS entity_id,
@@ -181,7 +181,7 @@
argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
argMin(events.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
FROM events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`)))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`)))
GROUP BY entity_id),
metric_events AS
(SELECT if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`) AS entity_id,
@@ -236,7 +236,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -298,7 +298,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -360,7 +360,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -422,7 +422,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -484,7 +484,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -546,7 +546,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -608,7 +608,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -670,7 +670,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -732,7 +732,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -918,7 +918,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(and(equals(events.event, '$feature_flag_called'), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'free'), 1)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'free'), 1)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1042,7 +1042,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1104,7 +1104,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1166,7 +1166,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1228,7 +1228,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1290,7 +1290,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1352,7 +1352,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(not(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)')), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(not(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)')), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1414,7 +1414,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1476,7 +1476,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/flag_doesnt_exist'), ''), 'null'), '^"|"$', ''), tuple('test', 'control')), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/flag_doesnt_exist'), ''), 'null'), '^"|"$', ''), tuple('test', 'control')), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1538,7 +1538,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1610,10 +1610,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
- (SELECT person_static_cohort.person_id AS person_id
- FROM person_static_cohort
- WHERE and(equals(person_static_cohort.team_id, 99999), equals(person_static_cohort.cohort_id, 99999)))), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
+ (SELECT person_static_cohort.person_id AS person_id
+ FROM person_static_cohort
+ WHERE and(equals(person_static_cohort.team_id, 99999), equals(person_static_cohort.cohort_id, 99999)))), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1675,7 +1675,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1747,10 +1747,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
- (SELECT cohortpeople.person_id AS person_id
- FROM cohortpeople
- WHERE and(equals(cohortpeople.team_id, 99999), equals(cohortpeople.cohort_id, 99999), equals(cohortpeople.version, 0)))), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
+ (SELECT cohortpeople.person_id AS person_id
+ FROM cohortpeople
+ WHERE and(equals(cohortpeople.team_id, 99999), equals(cohortpeople.cohort_id, 99999), equals(cohortpeople.version, 0)))), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1812,7 +1812,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1882,7 +1882,7 @@
WHERE and(equals(groups.team_id, 99999), equals(index, 0))
GROUP BY groups.group_type_index,
groups.group_key) AS events__group_0 ON equals(events.`$group_0`, events__group_0.key)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(equals(events__group_0.properties___name, 'Test Group'), 0), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(equals(events__group_0.properties___name, 'Test Group'), 0), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1944,7 +1944,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2006,7 +2006,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), match(events.elements_chain, '(^|;)button(\\.|$|;|:)'), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), match(events.elements_chain, '(^|;)button(\\.|$|;|:)'), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2068,7 +2068,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2130,7 +2130,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2192,7 +2192,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2254,7 +2254,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2316,7 +2316,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2378,7 +2378,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2433,7 +2433,7 @@
argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
argMin(events.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
FROM events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`)))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`)))
GROUP BY entity_id),
metric_events AS
(SELECT if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`) AS entity_id,
@@ -2488,7 +2488,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2602,7 +2602,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.new_events_schema.ambr
index 1a22540738f4..d7bdc62cc7bb 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.new_events_schema.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -80,7 +80,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -137,7 +137,7 @@
argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
argMin(events.properties.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`)))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`)))
GROUP BY entity_id),
metric_events AS
(SELECT if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`) AS entity_id,
@@ -187,7 +187,7 @@
argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
argMin(events.properties.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`)))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`)))
GROUP BY entity_id),
metric_events AS
(SELECT if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`) AS entity_id,
@@ -244,7 +244,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -308,7 +308,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -372,7 +372,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -436,7 +436,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -500,7 +500,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -564,7 +564,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -628,7 +628,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -692,7 +692,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -756,7 +756,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -948,7 +948,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(and(equals(events.event, '$feature_flag_called'), ifNull(notEquals(CAST(events.properties.plan, 'Nullable(String)'), 'free'), 1)), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(notEquals(CAST(events.properties.plan, 'Nullable(String)'), 'free'), 1)), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1076,7 +1076,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1140,7 +1140,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1204,7 +1204,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1268,7 +1268,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1332,7 +1332,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1396,7 +1396,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1460,7 +1460,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(not(match(toString(if(notEquals(toJSONString(events.properties.^`$host`), '{}'), toJSONString(events.properties.^`$host`), if(isNull(nullIf(toString(events.properties.`$host`), '')), NULL, if(and(in(ascii(toString(events.properties.`$host`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$host`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$host`), '[]'), '{}'), toString(events.properties.`$host`))))), '^(localhost|127\\.0\\.0\\.1)($|:)')), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(not(match(toString(if(notEquals(toJSONString(events.properties.^`$host`), '{}'), toJSONString(events.properties.^`$host`), if(isNull(nullIf(toString(events.properties.`$host`), '')), NULL, if(and(in(ascii(toString(events.properties.`$host`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$host`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$host`), '[]'), '{}'), toString(events.properties.`$host`))))), '^(localhost|127\\.0\\.0\\.1)($|:)')), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1524,7 +1524,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1588,7 +1588,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(has(events.properties.`$feature_flags`, 'flag_doesnt_exist'), multiIf(ifNull(equals(events.properties.`$feature_flags`['flag_doesnt_exist'], '$false'), 0), 'false', ifNull(equals(events.properties.`$feature_flags`['flag_doesnt_exist'], '$true'), 0), 'true', events.properties.`$feature_flags`['flag_doesnt_exist']), NULL), tuple('test', 'control')), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(has(events.properties.`$feature_flags`, 'flag_doesnt_exist'), multiIf(ifNull(equals(events.properties.`$feature_flags`['flag_doesnt_exist'], '$false'), 0), 'false', ifNull(equals(events.properties.`$feature_flags`['flag_doesnt_exist'], '$true'), 0), 'true', events.properties.`$feature_flags`['flag_doesnt_exist']), NULL), tuple('test', 'control')), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1652,7 +1652,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1716,10 +1716,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
- (SELECT person_static_cohort.person_id AS person_id
- FROM person_static_cohort
- WHERE and(equals(person_static_cohort.team_id, 99999), equals(person_static_cohort.cohort_id, 99999)))), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
+ (SELECT person_static_cohort.person_id AS person_id
+ FROM person_static_cohort
+ WHERE and(equals(person_static_cohort.team_id, 99999), equals(person_static_cohort.cohort_id, 99999)))), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1783,7 +1783,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1847,10 +1847,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
- (SELECT cohortpeople.person_id AS person_id
- FROM cohortpeople
- WHERE and(equals(cohortpeople.team_id, 99999), equals(cohortpeople.cohort_id, 99999), equals(cohortpeople.version, 0)))), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
+ (SELECT cohortpeople.person_id AS person_id
+ FROM cohortpeople
+ WHERE and(equals(cohortpeople.team_id, 99999), equals(cohortpeople.cohort_id, 99999), equals(cohortpeople.version, 0)))), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1914,7 +1914,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1986,7 +1986,7 @@
WHERE and(equals(groups.team_id, 99999), equals(index, 0))
GROUP BY groups.group_type_index,
groups.group_key) AS events__group_0 ON equals(events.properties.`$group_0`, events__group_0.key)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(equals(events__group_0.properties___name, 'Test Group'), 0), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(equals(events__group_0.properties___name, 'Test Group'), 0), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2050,7 +2050,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2114,7 +2114,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), match(events.elements_chain, '(^|;)button(\\.|$|;|:)'), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), match(events.elements_chain, '(^|;)button(\\.|$|;|:)'), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2178,7 +2178,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2242,7 +2242,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2306,7 +2306,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2370,7 +2370,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2434,7 +2434,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2491,7 +2491,7 @@
argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
argMin(events.properties.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`)))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`)))
GROUP BY entity_id),
metric_events AS
(SELECT if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`) AS entity_id,
@@ -2548,7 +2548,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -2612,7 +2612,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.ambr
index c4b550793158..582baccbb990 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.ambr
@@ -7,7 +7,7 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
coalesce(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', '')), '$$_posthog_breakdown_null_$$') AS breakdown_value_1,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events
LEFT OUTER JOIN
@@ -17,7 +17,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -58,7 +58,7 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
coalesce(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'country'), ''), 'null'), '^"|"$', '')), '$$_posthog_breakdown_null_$$') AS breakdown_value_1,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -69,7 +69,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -111,7 +111,7 @@
events.uuid AS uuid,
coalesce(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', '')), '$$_posthog_breakdown_null_$$') AS breakdown_value_1,
coalesce(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$os'), ''), 'null'), '^"|"$', '')), '$$_posthog_breakdown_null_$$') AS breakdown_value_2,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events
LEFT OUTER JOIN
@@ -121,7 +121,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -175,7 +175,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -243,7 +243,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -311,7 +311,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -379,7 +379,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -448,7 +448,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -521,7 +521,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -590,7 +590,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -663,7 +663,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -745,7 +745,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -818,7 +818,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -886,7 +886,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -983,7 +983,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1081,7 +1081,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1182,7 +1182,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1267,7 +1267,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1353,7 +1353,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.new_events_schema.ambr
index 4b12fa4e7135..312480cc8783 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.new_events_schema.ambr
@@ -7,7 +7,7 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
coalesce(toString(if(notEquals(toJSONString(events.properties.^`$browser`), '{}'), toJSONString(events.properties.^`$browser`), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(events.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$browser`), '[]'), '{}'), toString(events.properties.`$browser`))))), '$$_posthog_breakdown_null_$$') AS breakdown_value_1,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events_json AS events
LEFT OUTER JOIN
@@ -17,7 +17,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -60,7 +60,7 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
coalesce(toString(if(notEquals(toJSONString(events.person_properties.^country), '{}'), toJSONString(events.person_properties.^country), if(isNull(nullIf(toString(events.person_properties.country), '')), NULL, if(and(in(ascii(toString(events.person_properties.country)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.country)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.country), '[]'), '{}'), toString(events.person_properties.country))))), '$$_posthog_breakdown_null_$$') AS breakdown_value_1,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -71,7 +71,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -115,7 +115,7 @@
events.uuid AS uuid,
coalesce(toString(if(notEquals(toJSONString(events.properties.^`$browser`), '{}'), toJSONString(events.properties.^`$browser`), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(events.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$browser`), '[]'), '{}'), toString(events.properties.`$browser`))))), '$$_posthog_breakdown_null_$$') AS breakdown_value_1,
coalesce(toString(if(notEquals(toJSONString(events.properties.^`$os`), '{}'), toJSONString(events.properties.^`$os`), if(isNull(nullIf(toString(events.properties.`$os`), '')), NULL, if(and(in(ascii(toString(events.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$os`), '[]'), '{}'), toString(events.properties.`$os`))))), '$$_posthog_breakdown_null_$$') AS breakdown_value_2,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events_json AS events
LEFT OUTER JOIN
@@ -125,7 +125,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -181,7 +181,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -251,7 +251,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -321,7 +321,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -391,7 +391,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -462,7 +462,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -537,7 +537,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -608,7 +608,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -683,7 +683,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -767,7 +767,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -842,7 +842,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -912,7 +912,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1011,7 +1011,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1111,7 +1111,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1214,7 +1214,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1301,7 +1301,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1389,7 +1389,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.ambr
index cb8251cc344a..feec8e4cc264 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.ambr
@@ -17,7 +17,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -75,7 +75,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -161,7 +161,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -218,7 +218,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -275,7 +275,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -332,7 +332,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -389,7 +389,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -446,7 +446,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -503,7 +503,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -553,7 +553,7 @@
argMin(events.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id,
argMin(events.distinct_id, toTimeZone(events.timestamp, 'UTC')) AS exposure_identifier
FROM events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(events.`$group_0`))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(events.`$group_0`))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -610,7 +610,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -667,7 +667,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -724,7 +724,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(not(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)')), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(not(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)')), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -781,7 +781,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -838,7 +838,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/flag_doesnt_exist'), ''), 'null'), '^"|"$', ''), tuple('test', 'control')), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/flag_doesnt_exist'), ''), 'null'), '^"|"$', ''), tuple('test', 'control')), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -895,7 +895,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -962,10 +962,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
- (SELECT person_static_cohort.person_id AS person_id
- FROM person_static_cohort
- WHERE and(equals(person_static_cohort.team_id, 99999), equals(person_static_cohort.cohort_id, 99999)))), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
+ (SELECT person_static_cohort.person_id AS person_id
+ FROM person_static_cohort
+ WHERE and(equals(person_static_cohort.team_id, 99999), equals(person_static_cohort.cohort_id, 99999)))), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1022,7 +1022,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1089,10 +1089,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
- (SELECT cohortpeople.person_id AS person_id
- FROM cohortpeople
- WHERE and(equals(cohortpeople.team_id, 99999), equals(cohortpeople.cohort_id, 99999), equals(cohortpeople.version, 0)))), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
+ (SELECT cohortpeople.person_id AS person_id
+ FROM cohortpeople
+ WHERE and(equals(cohortpeople.team_id, 99999), equals(cohortpeople.cohort_id, 99999), equals(cohortpeople.version, 0)))), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1149,7 +1149,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1214,7 +1214,7 @@
WHERE and(equals(groups.team_id, 99999), equals(index, 0))
GROUP BY groups.group_type_index,
groups.group_key) AS events__group_0 ON equals(events.`$group_0`, events__group_0.key)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(equals(events__group_0.properties___name, 'Test Group'), 0), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(equals(events__group_0.properties___name, 'Test Group'), 0), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1271,7 +1271,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1328,7 +1328,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), match(events.elements_chain, '(^|;)button(\\.|$|;|:)'), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), match(events.elements_chain, '(^|;)button(\\.|$|;|:)'), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1385,7 +1385,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1442,7 +1442,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_stripe_subscriptions__subscription_customer.customer_email AS entity_id,
@@ -1506,7 +1506,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT posthog_test_usage.userid AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.new_events_schema.ambr
index 5311541eb3e9..f7c0a82b0f1d 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_data_warehouse_metric.new_events_schema.ambr
@@ -17,7 +17,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -77,7 +77,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -165,7 +165,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -224,7 +224,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -283,7 +283,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -342,7 +342,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -401,7 +401,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -460,7 +460,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -519,7 +519,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -571,7 +571,7 @@
argMin(events.properties.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id,
argMin(events.distinct_id, toTimeZone(events.timestamp, 'UTC')) AS exposure_identifier
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(events.properties.`$group_0`))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(events.properties.`$group_0`))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -630,7 +630,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -689,7 +689,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -748,7 +748,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -807,7 +807,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(not(match(toString(if(notEquals(toJSONString(events.properties.^`$host`), '{}'), toJSONString(events.properties.^`$host`), if(isNull(nullIf(toString(events.properties.`$host`), '')), NULL, if(and(in(ascii(toString(events.properties.`$host`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$host`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$host`), '[]'), '{}'), toString(events.properties.`$host`))))), '^(localhost|127\\.0\\.0\\.1)($|:)')), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(not(match(toString(if(notEquals(toJSONString(events.properties.^`$host`), '{}'), toJSONString(events.properties.^`$host`), if(isNull(nullIf(toString(events.properties.`$host`), '')), NULL, if(and(in(ascii(toString(events.properties.`$host`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$host`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$host`), '[]'), '{}'), toString(events.properties.`$host`))))), '^(localhost|127\\.0\\.0\\.1)($|:)')), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -866,7 +866,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -925,7 +925,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(has(events.properties.`$feature_flags`, 'flag_doesnt_exist'), multiIf(ifNull(equals(events.properties.`$feature_flags`['flag_doesnt_exist'], '$false'), 0), 'false', ifNull(equals(events.properties.`$feature_flags`['flag_doesnt_exist'], '$true'), 0), 'true', events.properties.`$feature_flags`['flag_doesnt_exist']), NULL), tuple('test', 'control')), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(has(events.properties.`$feature_flags`, 'flag_doesnt_exist'), multiIf(ifNull(equals(events.properties.`$feature_flags`['flag_doesnt_exist'], '$false'), 0), 'false', ifNull(equals(events.properties.`$feature_flags`['flag_doesnt_exist'], '$true'), 0), 'true', events.properties.`$feature_flags`['flag_doesnt_exist']), NULL), tuple('test', 'control')), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -984,7 +984,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1043,10 +1043,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
- (SELECT person_static_cohort.person_id AS person_id
- FROM person_static_cohort
- WHERE and(equals(person_static_cohort.team_id, 99999), equals(person_static_cohort.cohort_id, 99999)))), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
+ (SELECT person_static_cohort.person_id AS person_id
+ FROM person_static_cohort
+ WHERE and(equals(person_static_cohort.team_id, 99999), equals(person_static_cohort.cohort_id, 99999)))), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1105,7 +1105,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1164,10 +1164,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
- (SELECT cohortpeople.person_id AS person_id
- FROM cohortpeople
- WHERE and(equals(cohortpeople.team_id, 99999), equals(cohortpeople.cohort_id, 99999), equals(cohortpeople.version, 0)))), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),
+ (SELECT cohortpeople.person_id AS person_id
+ FROM cohortpeople
+ WHERE and(equals(cohortpeople.team_id, 99999), equals(cohortpeople.cohort_id, 99999), equals(cohortpeople.version, 0)))), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1226,7 +1226,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1293,7 +1293,7 @@
WHERE and(equals(groups.team_id, 99999), equals(index, 0))
GROUP BY groups.group_type_index,
groups.group_key) AS events__group_0 ON equals(events.properties.`$group_0`, events__group_0.key)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(equals(events__group_0.properties___name, 'Test Group'), 0), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(equals(events__group_0.properties___name, 'Test Group'), 0), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1352,7 +1352,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1411,7 +1411,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), match(events.elements_chain, '(^|;)button(\\.|$|;|:)'), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), match(events.elements_chain, '(^|;)button(\\.|$|;|:)'), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_usage.userid AS entity_id,
@@ -1470,7 +1470,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT posthog_test_stripe_subscriptions__subscription_customer.customer_email AS entity_id,
@@ -1536,7 +1536,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT posthog_test_usage.userid AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_experiment_exposures_query_runner.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_experiment_exposures_query_runner.ambr
index 343702b1e8d4..7e1aceeb91c1 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_experiment_exposures_query_runner.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_experiment_exposures_query_runner.ambr
@@ -13,7 +13,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -51,7 +51,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -89,7 +89,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -127,7 +127,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -165,7 +165,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -227,7 +227,7 @@
if(greater(uniqExact(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '')), 1), '$multiple', any(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''))) AS variant,
toDateOrNull(toString(min(toTimeZone(events.timestamp, 'UTC')))) AS day
FROM events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-28 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`)))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-28 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.`$group_0`)))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -341,7 +341,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(and(equals(events.event, '$feature_flag_called'), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'free'), 1)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'free'), 1)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -379,7 +379,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -417,7 +417,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_experiment_exposures_query_runner.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_experiment_exposures_query_runner.new_events_schema.ambr
index ee2d518e9dd8..c9d7ae4c1d68 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_experiment_exposures_query_runner.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_experiment_exposures_query_runner.new_events_schema.ambr
@@ -13,7 +13,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -53,7 +53,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -93,7 +93,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -133,7 +133,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -173,7 +173,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -206,7 +206,7 @@
if(greater(uniqExact(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`))))), 1), '$multiple', any(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))))) AS variant,
toDateOrNull(toString(min(toTimeZone(events.timestamp, 'UTC')))) AS day
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-28 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`)))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-28 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(if(less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('today', 6, 'UTC')), '', events.properties.`$group_0`)))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -326,7 +326,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(and(equals(events.event, '$feature_flag_called'), ifNull(notEquals(CAST(events.properties.plan, 'Nullable(String)'), 'free'), 1)), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(notEquals(CAST(events.properties.plan, 'Nullable(String)'), 'free'), 1)), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -366,7 +366,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
@@ -406,7 +406,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-07 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id)
SELECT first_exposures.day AS day,
first_exposures.variant AS variant,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_frequentist_method.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_frequentist_method.ambr
index 9ac01bf72859..5780c4a9f749 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_frequentist_method.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_frequentist_method.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_frequentist_method.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_frequentist_method.new_events_schema.ambr
index 4a28070cef14..b8422e80d094 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_frequentist_method.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_frequentist_method.new_events_schema.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.ambr
index 6663a62864ed..96fd730c9611 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.ambr
@@ -6,7 +6,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -17,7 +17,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -54,7 +54,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -65,7 +65,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
first_exposures AS
(SELECT base_events.entity_id AS entity_id,
min(toTimeZone(base_events.timestamp, 'UTC')) AS first_exposure_time
@@ -109,7 +109,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'experiment-flag'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'experiment-flag'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -120,7 +120,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'experiment-flag'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'experiment-flag'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -157,7 +157,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events
LEFT OUTER JOIN
@@ -167,7 +167,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -204,7 +204,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -215,7 +215,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -252,7 +252,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -263,7 +263,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
first_exposures AS
(SELECT base_events.entity_id AS entity_id,
min(toTimeZone(base_events.timestamp, 'UTC')) AS first_exposure_time
@@ -307,7 +307,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -318,7 +318,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -355,7 +355,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -366,7 +366,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -403,7 +403,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -414,7 +414,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(86400)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(86400)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -451,7 +451,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'add to cart'), 1, 0) AS step_2,
if(equals(events.event, 'checkout started'), 1, 0) AS step_3,
@@ -466,7 +466,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'add to cart'), equals(events.event, 'checkout started'), equals(events.event, 'checkout completed'), equals(events.event, 'survey submitted'), equals(events.event, 'referral')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'add to cart'), equals(events.event, 'checkout started'), equals(events.event, 'checkout completed'), equals(events.event, 'survey submitted'), equals(events.event, 'referral')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -503,7 +503,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2,
if(equals(events.event, 'purchase'), 1, 0) AS step_3
@@ -515,7 +515,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -552,7 +552,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'wizard_step'), ''), 'null'), '^"|"$', ''), 'step_1'), 0)), 1, 0) AS step_1,
if(and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'wizard_step'), ''), 'null'), '^"|"$', ''), 'step_2'), 0)), 1, 0) AS step_2
FROM events
@@ -563,7 +563,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'wizard_step'), ''), 'null'), '^"|"$', ''), 'step_1'), 0)), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'wizard_step'), ''), 'null'), '^"|"$', ''), 'step_2'), 0))))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'wizard_step'), ''), 'null'), '^"|"$', ''), 'step_1'), 0)), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'wizard_step'), ''), 'null'), '^"|"$', ''), 'step_2'), 0))))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -600,7 +600,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -611,7 +611,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
first_exposures AS
(SELECT base_events.entity_id AS entity_id,
min(toTimeZone(base_events.timestamp, 'UTC')) AS first_exposure_time
@@ -655,7 +655,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -666,7 +666,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -703,7 +703,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events
@@ -714,7 +714,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -762,7 +762,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$user_id'), ''), 'null'), '^"|"$', '')) AS entity_id,
@@ -770,11 +770,11 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), 1, 0) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events
- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), equals(events.event, '$pageview')))
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), equals(events.event, '$pageview')))
UNION ALL SELECT toString(posthog_test_usage.userid) AS entity_id,
'' AS variant,
posthog_test_usage.ds AS timestamp,
@@ -834,7 +834,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$user_id'), ''), 'null'), '^"|"$', '')) AS entity_id,
@@ -842,11 +842,11 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), 1, 0) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events
- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), equals(events.event, '$pageview')))
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), equals(events.event, '$pageview')))
UNION ALL SELECT toString(posthog_test_usage.userid) AS entity_id,
'' AS variant,
posthog_test_usage.ds AS timestamp,
@@ -906,7 +906,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$user_id'), ''), 'null'), '^"|"$', '')) AS entity_id,
@@ -914,11 +914,11 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), 1, 0) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events
- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), equals(events.event, '$pageview')))
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), equals(events.event, '$pageview')))
UNION ALL SELECT toString(posthog_test_usage.userid) AS entity_id,
'' AS variant,
posthog_test_usage.ds AS timestamp,
@@ -978,7 +978,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$user_id'), ''), 'null'), '^"|"$', '')) AS entity_id,
@@ -986,11 +986,11 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), 1, 0) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events
- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), equals(events.event, '$pageview')))
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), equals(events.event, '$pageview')))
UNION ALL SELECT toString(posthog_test_usage.userid) AS entity_id,
'' AS variant,
posthog_test_usage.ds AS timestamp,
@@ -1039,7 +1039,7 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events
LEFT OUTER JOIN
@@ -1049,7 +1049,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -1137,10 +1137,10 @@
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '') AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(events.`$group_0`)) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(events.`$group_0`)) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(events.`$group_0`)), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']), notEmpty(events.`$group_0`)), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.new_events_schema.ambr
index 7792379f75cb..0978c3bc3e63 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.new_events_schema.ambr
@@ -6,7 +6,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -17,7 +17,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -56,7 +56,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -67,7 +67,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
first_exposures AS
(SELECT base_events.entity_id AS entity_id,
min(toTimeZone(base_events.timestamp, 'UTC')) AS first_exposure_time
@@ -113,7 +113,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'experiment-flag'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'experiment-flag'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -124,7 +124,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'experiment-flag'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'experiment-flag'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -163,7 +163,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events_json AS events
LEFT OUTER JOIN
@@ -173,7 +173,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-02 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-10 00:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -212,7 +212,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -223,7 +223,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
first_exposures AS
(SELECT base_events.entity_id AS entity_id,
min(toTimeZone(base_events.timestamp, 'UTC')) AS first_exposure_time
@@ -269,7 +269,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -280,7 +280,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -319,7 +319,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -330,7 +330,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -369,7 +369,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -380,7 +380,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -419,7 +419,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -430,7 +430,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(86400)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(86400)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -469,7 +469,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'add to cart'), 1, 0) AS step_2,
if(equals(events.event, 'checkout started'), 1, 0) AS step_3,
@@ -484,7 +484,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'add to cart'), equals(events.event, 'checkout started'), equals(events.event, 'checkout completed'), equals(events.event, 'survey submitted'), equals(events.event, 'referral')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'add to cart'), equals(events.event, 'checkout started'), equals(events.event, 'checkout completed'), equals(events.event, 'survey submitted'), equals(events.event, 'referral')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -523,7 +523,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2,
if(equals(events.event, 'purchase'), 1, 0) AS step_3
@@ -535,7 +535,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -574,7 +574,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(and(equals(events.event, '$pageview'), ifNull(equals(CAST(events.properties.wizard_step, 'Nullable(String)'), 'step_1'), 0)), 1, 0) AS step_1,
if(and(equals(events.event, '$pageview'), ifNull(equals(CAST(events.properties.wizard_step, 'Nullable(String)'), 'step_2'), 0)), 1, 0) AS step_2
FROM events_json AS events
@@ -585,7 +585,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$pageview'), ifNull(equals(CAST(events.properties.wizard_step, 'Nullable(String)'), 'step_1'), 0)), and(equals(events.event, '$pageview'), ifNull(equals(CAST(events.properties.wizard_step, 'Nullable(String)'), 'step_2'), 0))))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(and(equals(events.event, '$pageview'), ifNull(equals(CAST(events.properties.wizard_step, 'Nullable(String)'), 'step_1'), 0)), and(equals(events.event, '$pageview'), ifNull(equals(CAST(events.properties.wizard_step, 'Nullable(String)'), 'step_2'), 0))))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -624,7 +624,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -635,7 +635,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
first_exposures AS
(SELECT base_events.entity_id AS entity_id,
min(toTimeZone(base_events.timestamp, 'UTC')) AS first_exposure_time
@@ -681,7 +681,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -692,7 +692,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -731,7 +731,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
if(equals(events.event, 'purchase'), 1, 0) AS step_2
FROM events_json AS events
@@ -742,7 +742,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), or(equals(events.event, '$pageview'), equals(events.event, 'purchase')))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -792,7 +792,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(if(notEquals(toJSONString(events.properties.^`$user_id`), '{}'), toJSONString(events.properties.^`$user_id`), if(isNull(nullIf(toString(events.properties.`$user_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$user_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$user_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$user_id`), '[]'), '{}'), toString(events.properties.`$user_id`))))) AS entity_id,
@@ -800,11 +800,11 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), 1, 0) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), equals(events.event, '$pageview')))
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), equals(events.event, '$pageview')))
UNION ALL SELECT toString(posthog_test_usage.userid) AS entity_id,
'' AS variant,
posthog_test_usage.ds AS timestamp,
@@ -866,7 +866,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(if(notEquals(toJSONString(events.properties.^`$user_id`), '{}'), toJSONString(events.properties.^`$user_id`), if(isNull(nullIf(toString(events.properties.`$user_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$user_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$user_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$user_id`), '[]'), '{}'), toString(events.properties.`$user_id`))))) AS entity_id,
@@ -874,11 +874,11 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), 1, 0) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), equals(events.event, '$pageview')))
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), equals(events.event, '$pageview')))
UNION ALL SELECT toString(posthog_test_usage.userid) AS entity_id,
'' AS variant,
posthog_test_usage.ds AS timestamp,
@@ -940,7 +940,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(if(notEquals(toJSONString(events.properties.^`$user_id`), '{}'), toJSONString(events.properties.^`$user_id`), if(isNull(nullIf(toString(events.properties.`$user_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$user_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$user_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$user_id`), '[]'), '{}'), toString(events.properties.`$user_id`))))) AS entity_id,
@@ -948,11 +948,11 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), 1, 0) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), equals(events.event, '$pageview')))
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), equals(events.event, '$pageview')))
UNION ALL SELECT toString(posthog_test_usage.userid) AS entity_id,
'' AS variant,
posthog_test_usage.ds AS timestamp,
@@ -1014,7 +1014,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT toString(if(notEquals(toJSONString(events.properties.^`$user_id`), '{}'), toJSONString(events.properties.^`$user_id`), if(isNull(nullIf(toString(events.properties.`$user_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$user_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$user_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$user_id`), '[]'), '{}'), toString(events.properties.`$user_id`))))) AS entity_id,
@@ -1022,11 +1022,11 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
if(notEquals(toJSONString(events.properties.^`$session_id`), '{}'), toJSONString(events.properties.^`$session_id`), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$session_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$session_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))) AS session_id,
- if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), 1, 0) AS step_0,
+ if(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), 1, 0) AS step_0,
if(equals(events.event, '$pageview'), 1, 0) AS step_1,
0 AS step_2
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), equals(events.event, '$pageview')))
+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC')))), or(and(greaterOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2023-01-31 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), equals(events.event, '$pageview')))
UNION ALL SELECT toString(posthog_test_usage.userid) AS entity_id,
'' AS variant,
posthog_test_usage.ds AS timestamp,
@@ -1077,7 +1077,7 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events_json AS events
LEFT OUTER JOIN
@@ -1087,7 +1087,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test'])), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
@@ -1126,10 +1126,10 @@
if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))) AS variant_value,
toTimeZone(events.timestamp, 'UTC') AS timestamp,
events.uuid AS uuid,
- and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(events.properties.`$group_0`)) AS step_0,
+ and(greaterOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(toTimeZone(events.timestamp, 'UTC'), assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(events.properties.`$group_0`)) AS step_0,
if(equals(events.event, 'purchase'), 1, 0) AS step_1
FROM events_json AS events
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(events.properties.`$group_0`)), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
+ WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']), notEmpty(events.properties.`$group_0`)), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), equals(events.event, 'purchase'))))),
entity_metrics AS
(SELECT base_events.entity_id AS entity_id,
if(greater(uniqExactIf(base_events.variant_value, equals(base_events.step_0, 1)), 1), '$multiple', anyIf(base_events.variant_value, equals(base_events.step_0, 1))) AS variant,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_mean_metric.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_mean_metric.ambr
index b970f3640eec..9b091cd597e8 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_mean_metric.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_mean_metric.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -78,7 +78,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -140,7 +140,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -212,7 +212,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id
HAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-15 12:00:00', 6, 'UTC'))),
metric_events AS
@@ -275,7 +275,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -347,7 +347,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -419,7 +419,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -491,7 +491,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -553,7 +553,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -615,7 +615,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -677,7 +677,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -791,7 +791,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -853,7 +853,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_mean_metric.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_mean_metric.new_events_schema.ambr
index d33c5275ad65..7495d68e3648 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_mean_metric.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_mean_metric.new_events_schema.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -80,7 +80,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -144,7 +144,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -218,7 +218,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id
HAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-15 12:00:00', 6, 'UTC'))),
metric_events AS
@@ -283,7 +283,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -357,7 +357,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -431,7 +431,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -505,7 +505,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -569,7 +569,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -633,7 +633,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -697,7 +697,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -761,7 +761,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -825,7 +825,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_ratio_metric.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_ratio_metric.ambr
index 7d38aa5c8468..a6b0737d48d9 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_ratio_metric.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_ratio_metric.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -194,7 +194,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id
HAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-15 12:00:00', 6, 'UTC'))),
numerator_events AS
@@ -287,7 +287,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -392,7 +392,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -498,7 +498,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -610,7 +610,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -702,7 +702,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -794,7 +794,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -886,7 +886,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -978,7 +978,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1070,7 +1070,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_ratio_metric.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_ratio_metric.new_events_schema.ambr
index 11296bc1a65c..168f60071dc9 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_ratio_metric.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_ratio_metric.new_events_schema.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -198,7 +198,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id
HAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-15 12:00:00', 6, 'UTC'))),
numerator_events AS
@@ -293,7 +293,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -400,7 +400,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -508,7 +508,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -622,7 +622,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -716,7 +716,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -810,7 +810,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -904,7 +904,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -998,7 +998,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
@@ -1092,7 +1092,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
numerator_events AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_retention_metric.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_retention_metric.ambr
index f76e4e4b51ad..ef89aba3ff05 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_retention_metric.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_retention_metric.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -161,7 +161,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -242,7 +242,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -394,7 +394,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -546,7 +546,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -680,6 +680,77 @@
use_hive_partitioning=0
'''
# ---
+# name: TestExperimentRetentionMetric.test_retention_exposure_start_excludes_exposure_as_its_own_completion_2_flag_call_with_copies_direct
+ '''
+ WITH exposures AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ if(greater(uniqExact(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', '')), 1), '$multiple', any(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''))) AS variant,
+ min(toTimeZone(events.timestamp, 'UTC')) AS first_exposure_time,
+ max(toTimeZone(events.timestamp, 'UTC')) AS last_exposure_time,
+ argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
+ argMin(events.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
+ FROM events
+ 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 equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ GROUP BY entity_id),
+ start_events AS
+ (SELECT exposures.entity_id AS entity_id,
+ toTimeZone(exposures.first_exposure_time, 'UTC') AS start_timestamp,
+ exposures.exposure_event_uuid AS start_uuid
+ FROM exposures
+ WHERE 1),
+ completion_events AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ events.uuid AS completion_uuid,
+ toTimeZone(events.timestamp, 'UTC') AS completion_timestamp
+ FROM events
+ 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 equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, '$feature_flag_called'))),
+ entity_metrics AS
+ (SELECT exposures.entity_id AS entity_id,
+ exposures.variant AS variant,
+ max(if(and(isNotNull(toTimeZone(completion_events.completion_timestamp, 'UTC')), greaterOrEquals(toStartOfDay(toTimeZone(completion_events.completion_timestamp, 'UTC')), plus(toStartOfDay(toTimeZone(start_events.start_timestamp, 'UTC')), toIntervalDay(0))), lessOrEquals(toStartOfDay(toTimeZone(completion_events.completion_timestamp, 'UTC')), plus(toStartOfDay(toTimeZone(start_events.start_timestamp, 'UTC')), toIntervalDay(7)))), 1, 0)) AS value
+ FROM exposures
+ INNER JOIN start_events ON equals(exposures.entity_id, start_events.entity_id)
+ LEFT JOIN completion_events ON and(equals(exposures.entity_id, completion_events.entity_id), and(greaterOrEquals(toTimeZone(completion_events.completion_timestamp, 'UTC'), toTimeZone(start_events.start_timestamp, 'UTC')), lessOrEquals(toTimeZone(completion_events.completion_timestamp, 'UTC'), plus(toTimeZone(start_events.start_timestamp, 'UTC'), toIntervalSecond(691200)))), notEquals(completion_events.completion_uuid, start_events.start_uuid))
+ GROUP BY exposures.entity_id,
+ exposures.variant)
+ SELECT entity_metrics.variant AS variant,
+ count(entity_metrics.entity_id) AS num_users,
+ sum(entity_metrics.value) AS total_sum,
+ sum(power(entity_metrics.value, 2)) AS total_sum_of_squares,
+ count(entity_metrics.entity_id) AS denominator_sum,
+ count(entity_metrics.entity_id) AS denominator_sum_squares,
+ sum(entity_metrics.value) AS numerator_denominator_sum_product
+ FROM entity_metrics
+ WHERE notEmpty(variant)
+ GROUP BY entity_metrics.variant
+ LIMIT 50000 SETTINGS readonly=2,
+ max_execution_time=600,
+ allow_experimental_object_type=1,
+ max_ast_elements=4000000,
+ max_expanded_ast_elements=4000000,
+ max_bytes_before_external_group_by=39728447488,
+ transform_null_in=1,
+ optimize_min_equality_disjunction_chain_length=4294967295,
+ optimize_rewrite_aggregate_function_with_if=0,
+ optimize_min_inequality_conjunction_chain_length=4294967295,
+ allow_experimental_join_condition=1,
+ use_hive_partitioning=0
+ '''
+# ---
# name: TestExperimentRetentionMetric.test_retention_first_seen_vs_last_seen_0_direct
'''
WITH exposures AS
@@ -697,7 +768,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -777,7 +848,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -857,7 +928,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -937,7 +1008,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1017,7 +1088,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment-3-variants'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test_a', 'test_b']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment-3-variants'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test_a', 'test_b']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1097,7 +1168,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1177,7 +1248,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1257,7 +1328,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1337,7 +1408,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_retention_metric.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_retention_metric.new_events_schema.ambr
index 26ba1698d8ae..f5c57e1fb4cb 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_retention_metric.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_retention_metric.new_events_schema.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -98,7 +98,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -181,7 +181,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -337,7 +337,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -493,7 +493,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -631,6 +631,79 @@
output_format_json_escape_forward_slashes=0
'''
# ---
+# name: TestExperimentRetentionMetric.test_retention_exposure_start_excludes_exposure_as_its_own_completion_2_flag_call_with_copies_direct[new_events_schema]
+ '''
+ WITH exposures AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ if(greater(uniqExact(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`))))), 1), '$multiple', any(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))))) AS variant,
+ min(toTimeZone(events.timestamp, 'UTC')) AS first_exposure_time,
+ max(toTimeZone(events.timestamp, 'UTC')) AS last_exposure_time,
+ argMin(events.uuid, toTimeZone(events.timestamp, 'UTC')) AS exposure_event_uuid,
+ argMin(events.properties.`$session_id`, toTimeZone(events.timestamp, 'UTC')) AS exposure_session_id
+ FROM events_json AS events
+ 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 equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ GROUP BY entity_id),
+ start_events AS
+ (SELECT exposures.entity_id AS entity_id,
+ toTimeZone(exposures.first_exposure_time, 'UTC') AS start_timestamp,
+ exposures.exposure_event_uuid AS start_uuid
+ FROM exposures
+ WHERE 1),
+ completion_events AS
+ (SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
+ events.uuid AS completion_uuid,
+ toTimeZone(events.timestamp, 'UTC') AS completion_timestamp
+ FROM events_json AS events
+ 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 equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, '$feature_flag_called'))),
+ entity_metrics AS
+ (SELECT exposures.entity_id AS entity_id,
+ exposures.variant AS variant,
+ max(if(and(isNotNull(toTimeZone(completion_events.completion_timestamp, 'UTC')), greaterOrEquals(toStartOfDay(toTimeZone(completion_events.completion_timestamp, 'UTC')), plus(toStartOfDay(toTimeZone(start_events.start_timestamp, 'UTC')), toIntervalDay(0))), lessOrEquals(toStartOfDay(toTimeZone(completion_events.completion_timestamp, 'UTC')), plus(toStartOfDay(toTimeZone(start_events.start_timestamp, 'UTC')), toIntervalDay(7)))), 1, 0)) AS value
+ FROM exposures
+ INNER JOIN start_events ON equals(exposures.entity_id, start_events.entity_id)
+ LEFT JOIN completion_events ON and(equals(exposures.entity_id, completion_events.entity_id), and(greaterOrEquals(toTimeZone(completion_events.completion_timestamp, 'UTC'), toTimeZone(start_events.start_timestamp, 'UTC')), lessOrEquals(toTimeZone(completion_events.completion_timestamp, 'UTC'), plus(toTimeZone(start_events.start_timestamp, 'UTC'), toIntervalSecond(691200)))), notEquals(completion_events.completion_uuid, start_events.start_uuid))
+ GROUP BY exposures.entity_id,
+ exposures.variant)
+ SELECT entity_metrics.variant AS variant,
+ count(entity_metrics.entity_id) AS num_users,
+ sum(entity_metrics.value) AS total_sum,
+ sum(power(entity_metrics.value, 2)) AS total_sum_of_squares,
+ count(entity_metrics.entity_id) AS denominator_sum,
+ count(entity_metrics.entity_id) AS denominator_sum_squares,
+ sum(entity_metrics.value) AS numerator_denominator_sum_product
+ FROM entity_metrics
+ WHERE notEmpty(variant)
+ GROUP BY entity_metrics.variant
+ LIMIT 50000 SETTINGS readonly=2,
+ max_execution_time=600,
+ allow_experimental_object_type=1,
+ max_ast_elements=4000000,
+ max_expanded_ast_elements=4000000,
+ max_bytes_before_external_group_by=39728447488,
+ transform_null_in=1,
+ optimize_min_equality_disjunction_chain_length=4294967295,
+ optimize_rewrite_aggregate_function_with_if=0,
+ optimize_min_inequality_conjunction_chain_length=4294967295,
+ allow_experimental_join_condition=1,
+ use_hive_partitioning=0,
+ json_type_escape_dots_in_keys=1,
+ output_format_json_escape_forward_slashes=0
+ '''
+# ---
# name: TestExperimentRetentionMetric.test_retention_first_seen_vs_last_seen_0_direct[new_events_schema.1]
'''
WITH exposures AS
@@ -648,7 +721,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -730,7 +803,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -812,7 +885,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -894,7 +967,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -976,7 +1049,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment-3-variants'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test_a', 'test_b']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment-3-variants'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test_a', 'test_b']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1058,7 +1131,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1140,7 +1213,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1222,7 +1295,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
@@ -1304,7 +1377,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
start_events AS
(SELECT exposures.entity_id AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.ambr
index 4fbe88b11eae..c78475526980 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag'), ''), 'null'), '^"|"$', ''), 'test-experiment'), 0)), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), in(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature_flag_response'), ''), 'null'), '^"|"$', ''), ['control', 'test']))
GROUP BY entity_id),
metric_events_by_session AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.new_events_schema.ambr
index dc06367c1e1a..1d759230c500 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.new_events_schema.ambr
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.new_events_schema.ambr
@@ -16,7 +16,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC'))), and(in(events.event, ['$feature_flag_called', '$experiment_exposure']), ifNull(equals(CAST(events.properties.`$feature_flag`, 'Nullable(String)'), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(toJSONString(events.person_properties.^email), '{}'), toJSONString(events.person_properties.^email), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(toJSONString(events.properties.^`$feature_flag_response`), '{}'), toJSONString(events.properties.^`$feature_flag_response`), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag_response`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag_response`), '[]'), '{}'), toString(events.properties.`$feature_flag_response`)))), ['control', 'test']))
GROUP BY entity_id),
metric_events_by_session AS
(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_experiment_exposures_query_runner.py b/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_experiment_exposures_query_runner.py
index 17edc60c8598..5be5b6ff3e55 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_experiment_exposures_query_runner.py
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_experiment_exposures_query_runner.py
@@ -161,11 +161,11 @@ class TestExperimentExposuresQueryRunner(ExperimentQueryRunnerBaseTest):
@parameterized.expand(
[
# (name, flag enabled, experiment start/end offsets, query start offset, expected exposures)
- ("fully_before_cutoff", True, -14, -7, -14, {"control": 2, "test": 1}),
- ("start_before_end_after_cutoff", True, -7, 7, -7, {"control": 2, "test": 1}),
+ ("fully_before_cutoff", True, -14, -7, -14, {"control": 3, "test": 3}),
+ ("start_before_end_after_cutoff", True, -7, 7, -7, {"control": 3, "test": 3}),
("fully_after_cutoff", True, 7, 14, 7, {"control": 1, "test": 2}),
- ("fully_after_cutoff_flag_disabled", False, 7, 14, 7, {"control": 2, "test": 1}),
- ("query_window_starts_after_cutoff", True, -7, 14, 7, {"control": 2, "test": 1}),
+ ("fully_after_cutoff_flag_disabled", False, 7, 14, 7, {"control": 3, "test": 3}),
+ ("query_window_starts_after_cutoff", True, -7, 14, 7, {"control": 3, "test": 3}),
]
)
@time_machine.travel(EXPERIMENT_EXPOSURE_EVENT_CUTOFF + timedelta(days=30), tick=False)
@@ -207,7 +207,9 @@ class TestExperimentExposuresQueryRunner(ExperimentQueryRunnerBaseTest):
# Both events are seeded inside every experiment window, with disjoint user sets and
# asymmetric counts, so total_exposures reveals which event the query counted:
# $feature_flag_called yields control=2/test=1, $experiment_exposure yields
- # control=1/test=2, and counting both would yield control=3/test=3.
+ # control=1/test=2, and counting both yields control=3/test=3. The users with only
+ # $experiment_exposure stand for exposures after ingestion stops writing
+ # $feature_flag_called, which an experiment on $feature_flag_called must still count.
journeys_for(
{
"user_legacy_control_1": [exposure("$feature_flag_called", "control", legacy_ts)],
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_funnel_metric.py b/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_funnel_metric.py
index c8632093f91f..8b67557e2c9d 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_funnel_metric.py
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_funnel_metric.py
@@ -161,6 +161,56 @@ class TestExperimentFunnelMetric(ExperimentQueryRunnerBaseTest):
# Check that we have the correct data for rendering the funnel chart
self.assertEqual(control_variant.step_counts, [8]) # contains data for funnel chart
+ @parameterized.expand(
+ [
+ # A pre-cutoff experiment reads $feature_flag_called with its same-timestamp
+ # $experiment_exposure copy, so the copy must not add a second exposure.
+ ("purchase_step_direct", False, "purchase"),
+ ("purchase_step_precomputed", True, "purchase"),
+ # With the flag call as the step, the copy must not act as the exposure and the call as its conversion.
+ ("flag_call_step_direct", False, "$feature_flag_called"),
+ ("flag_call_step_precomputed", True, "$feature_flag_called"),
+ ]
+ )
+ @time_machine.travel("2020-01-01T12:00:00Z", tick=False)
+ def test_funnel_metric_with_exposure_copies(self, _name: str, use_precomputation: bool, step_event: str) -> None:
+ self._setup_precomputation_test(use_precomputation)
+
+ feature_flag = self.create_feature_flag()
+ experiment = self.create_experiment(feature_flag=feature_flag)
+ experiment.stats_config = {"method": "frequentist"}
+ metric = ExperimentFunnelMetric(series=[EventsNode(event=step_event)])
+ experiment.metrics = [metric.model_dump(mode="json")]
+ self._save_experiment_with_precomputation(experiment, use_precomputation)
+
+ # Only user_control_returns converts: it is exposed again an hour later and purchases then.
+ for user, variant, returns in [
+ ("user_control_returns", "control", True),
+ ("user_control_once", "control", False),
+ ("user_test_once", "test", False),
+ ("user_test_once_2", "test", False),
+ ]:
+ _create_person(distinct_ids=[user], team_id=self.team.pk)
+ for timestamp in ["2020-01-02T12:00:00Z", "2020-01-02T13:00:00Z"] if returns else ["2020-01-02T12:00:00Z"]:
+ for event in ["$feature_flag_called", "$experiment_exposure"]:
+ _create_event(
+ team=self.team,
+ event=event,
+ distinct_id=user,
+ timestamp=timestamp,
+ properties={"$feature_flag_response": variant, "$feature_flag": feature_flag.key},
+ )
+ if returns:
+ _create_event(team=self.team, event="purchase", distinct_id=user, timestamp="2020-01-02T13:00:00Z")
+ flush_persons_and_events()
+
+ query = ExperimentQuery(experiment_id=experiment.id, kind="ExperimentQuery", metric=metric)
+ result = cast(ExperimentQueryResponse, ExperimentQueryRunner(query=query, team=self.team).calculate())
+
+ assert result.baseline is not None and result.variant_results is not None
+ self.assertEqual((result.baseline.number_of_samples, result.baseline.sum), (2, 1))
+ self.assertEqual((result.variant_results[0].number_of_samples, result.variant_results[0].sum), (2, 0))
+
@parameterized.expand(
[
("direct", False),
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_retention_metric.py b/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_retention_metric.py
index ea1fc641b402..1cef669127cb 100644
--- a/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_retention_metric.py
+++ b/products/experiments/backend/hogql_queries/test/experiment_query_runner/test_retention_metric.py
@@ -2119,14 +2119,18 @@ class TestExperimentRetentionMetric(ExperimentQueryRunnerBaseTest):
@parameterized.expand(
[
- ("direct", False),
- ("precomputed", True),
+ ("direct", False, ["entered_experiment"]),
+ ("precomputed", True, ["entered_experiment"]),
+ # The default exposure reads $feature_flag_called with its same-timestamp
+ # $experiment_exposure copy, so the copy must not be a start that the call returns from.
+ ("flag_call_with_copies_direct", False, ["$feature_flag_called", "$experiment_exposure"]),
+ ("flag_call_with_copies_precomputed", True, ["$feature_flag_called", "$experiment_exposure"]),
]
)
@time_machine.travel("2020-01-01T12:00:00Z", tick=False)
@snapshot_clickhouse_queries
def test_retention_exposure_start_excludes_exposure_as_its_own_completion(
- self, name: str, use_precomputation: bool
+ self, name: str, use_precomputation: bool, exposure_events: list[str]
) -> None:
# Guards the exposure_event_uuid exclusion: with a day-0 window and the
# completion event equal to the exposure event, the exposure occurrence
@@ -2136,14 +2140,14 @@ class TestExperimentRetentionMetric(ExperimentQueryRunnerBaseTest):
feature_flag = self.create_feature_flag()
experiment = self.create_experiment(feature_flag=feature_flag)
experiment.stats_config = {"method": "frequentist"}
- exposure_config = ExperimentEventExposureConfig(event="entered_experiment", properties=[])
+ exposure_config = ExperimentEventExposureConfig(event=exposure_events[0], properties=[])
experiment.exposure_criteria = {"exposure_config": exposure_config.model_dump(mode="json")}
experiment.save()
metric = ExperimentRetentionMetric(
start_event=ExperimentExposureNode(),
completion_event=EventsNode(
- event="entered_experiment",
+ event=exposure_events[0],
math=ExperimentMetricMathType.TOTAL,
),
retention_window_start=0,
@@ -2165,21 +2169,21 @@ class TestExperimentRetentionMetric(ExperimentQueryRunnerBaseTest):
def _create_user(variant: str, user_id: str, fires_again: bool) -> None:
_create_person(distinct_ids=[user_id], team_id=self.team.pk)
- _create_event(
- team=self.team,
- event="entered_experiment",
- distinct_id=user_id,
- timestamp="2020-01-02T12:00:00Z",
- properties={feature_flag_property: variant},
- )
- if fires_again:
- _create_event(
- team=self.team,
- event="entered_experiment",
- distinct_id=user_id,
- timestamp="2020-01-02T13:00:00Z",
- properties={feature_flag_property: variant},
- )
+ for timestamp in (
+ ["2020-01-02T12:00:00Z", "2020-01-02T13:00:00Z"] if fires_again else ["2020-01-02T12:00:00Z"]
+ ):
+ for event in exposure_events:
+ _create_event(
+ team=self.team,
+ event=event,
+ distinct_id=user_id,
+ timestamp=timestamp,
+ properties={
+ feature_flag_property: variant,
+ "$feature_flag_response": variant,
+ "$feature_flag": feature_flag.key,
+ },
+ )
_create_user("control", "user_control_repeat", fires_again=True)
_create_user("control", "user_control_once", fires_again=False)
diff --git a/products/experiments/backend/session_context.py b/products/experiments/backend/session_context.py
index c3e13dc938ce..44b488dcbc26 100644
--- a/products/experiments/backend/session_context.py
+++ b/products/experiments/backend/session_context.py
@@ -827,9 +827,9 @@ def _resolve_exposure(flag_key: str, exposure_criteria: Optional[dict]) -> _Reso
criteria = None
exposure_config = criteria.exposure_config if criteria else None
# This surface deliberately stays on the legacy default rather than resolving the
- # $experiment_exposure rollout per experiment: its shared flag-evaluations query reads
- # $feature_flag_called, and while ingestion emits both events every exposure still lands on
- # the same sessions, so the legacy event stays correct here for now.
+ # $experiment_exposure rollout per experiment. Its reads of $feature_flag_called also match the
+ # $experiment_exposure copy, which lands on the same session with the same properties, so they
+ # find an exposure whichever of the two events reaches the events table.
event, variant_property = get_exposure_event_and_property(
flag_key, criteria, default_exposure_event=DEFAULT_EXPOSURE_EVENT
)
@@ -898,20 +898,22 @@ def _query_flag_evaluations(
flag_key_windows: dict[str, list[_ScanWindow]],
variants: set[str],
) -> dict[str, dict[tuple[str, _ScanWindow], list[tuple[str, datetime]]]]:
- """The sessions' `$feature_flag_called` events for the given experiment flag keys and
- defined variant names, as session_id -> (flag_key, scan window) -> [(variant, first_seen)].
+ """The sessions' flag evaluations (`$feature_flag_called` and its `$experiment_exposure`
+ copy) for the given experiment flag keys and defined variant names, as
+ session_id -> (flag_key, scan window) -> [(variant, first_seen)].
Each key is read only over its experiments' own scan windows, so an evaluation from outside
an experiment's run window never reaches that experiment. Serves two roles: variant
evidence for every experiment (the replay shows what the session was served, whatever the
exposure criteria say), and the exposure moment for experiments whose criteria resolve to
the plain default shape (`$feature_flag_called` with no extra property filters).
- Shape-bound to `$feature_flag_called` on purpose — the `$feature_flag` batching key and
- the `$feature_flag_response` variant property come with that event, so all three are
- hardcoded together. If DEFAULT_EXPOSURE_EVENT changes in `exposure_query_logic`, this
- query needs no rewrite: flag evaluations stay `$feature_flag_called` events, and
- `_resolve_exposure` stops classifying criteria-less experiments as batchable, so their
- exposure moments move to the branch path."""
+ Shape-bound to the flag-evaluation events on purpose: the `$feature_flag` batching key and
+ the `$feature_flag_response` variant property come with `$feature_flag_called` and its copy,
+ so all three are hardcoded together. A call and its copy share a timestamp, so
+ `min(timestamp)` per group is the same as for the call alone. If DEFAULT_EXPOSURE_EVENT
+ changes in `exposure_query_logic`, this query needs no rewrite: flag evaluations stay these
+ events, and `_resolve_exposure` stops classifying criteria-less experiments as batchable, so
+ their exposure moments move to the branch path."""
if not flag_key_windows:
return {}
# One union branch per distinct clipped window, scanning the flag keys read over that
@@ -936,7 +938,7 @@ def _query_flag_evaluations(
toString(properties.$feature_flag_response) AS variant,
min(timestamp) AS first_seen
FROM events
- WHERE event = '$feature_flag_called'
+ WHERE event IN ('$feature_flag_called', '$experiment_exposure')
AND $session_id IN {session_ids}
AND properties.$feature_flag IN {flag_keys}
AND toString(properties.$feature_flag_response) IN {variants}
@@ -1000,7 +1002,8 @@ def _query_exposure_event_branches(
# Built here, after the branch cap, so classification stays DB-free for experiments
# the slice discards (action-based conditions cost a Postgres lookup each).
try:
- # The same deliberate legacy-event choice as `_resolve_exposure` above.
+ # The same deliberate legacy-default choice as `_resolve_exposure` above. The
+ # conditions also match the $experiment_exposure copy (`exposure_event_name_filter`).
conditions = build_exposure_event_conditions(
meta.resolution.criteria, team, meta.resolution.flag_key, default_exposure_event=DEFAULT_EXPOSURE_EVENT
)
diff --git a/products/experiments/backend/test/test_freeze_exposure_clickhouse.py b/products/experiments/backend/test/test_freeze_exposure_clickhouse.py
index 312ff558fc2d..7841c8b58eea 100644
--- a/products/experiments/backend/test/test_freeze_exposure_clickhouse.py
+++ b/products/experiments/backend/test/test_freeze_exposure_clickhouse.py
@@ -137,15 +137,15 @@ class TestFreezeExposureClickhouse(ClickhouseTestMixin, APIBaseTest):
@parameterized.expand(
[
- # (name, rollout flag enabled, experiment start offset from the cutoff, expected event)
- ("after_cutoff", True, 7, EXPERIMENT_EXPOSURE_EVENT),
- ("after_cutoff_flag_disabled", False, 7, "$feature_flag_called"),
- ("before_cutoff", True, -7, "$feature_flag_called"),
+ # (name, rollout flag enabled, experiment start offset from the cutoff, events read)
+ ("after_cutoff", True, 7, {EXPERIMENT_EXPOSURE_EVENT}),
+ ("after_cutoff_flag_disabled", False, 7, {"$feature_flag_called", EXPERIMENT_EXPOSURE_EVENT}),
+ ("before_cutoff", True, -7, {"$feature_flag_called", EXPERIMENT_EXPOSURE_EVENT}),
]
)
@time_machine.travel(EXPERIMENT_EXPOSURE_EVENT_CUTOFF + timedelta(days=10), tick=False)
def test_fetch_exposed_person_uuids_reads_the_resolved_exposure_event(
- self, _name: str, flag_enabled: bool, start_offset_days: int, expected_event: str
+ self, _name: str, flag_enabled: bool, start_offset_days: int, expected_events: set[str]
) -> None:
experiment = self._create_running_experiment(
"freeze-rollout-flag", start_date=EXPERIMENT_EXPOSURE_EVENT_CUTOFF + timedelta(days=start_offset_days)
@@ -166,10 +166,17 @@ class TestFreezeExposureClickhouse(ClickhouseTestMixin, APIBaseTest):
uuids = self._service()._fetch_exposed_person_uuids(experiment)
# The snapshot decides who keeps being served a variant, so it must count exposures on
- # the event the analysis resolves to: read off the other event, a post-cutoff experiment
- # would freeze an empty set once the two events stop being emitted together.
- expected_person = new_event_person if expected_event == EXPERIMENT_EXPOSURE_EVENT else legacy_event_person
- assert uuids == [str(expected_person.uuid)]
+ # the events the analysis reads. Otherwise an experiment would freeze an empty set once
+ # the two events stop being emitted together.
+ expected_uuids = [
+ str(person.uuid)
+ for event, person in (
+ (EXPERIMENT_EXPOSURE_EVENT, new_event_person),
+ ("$feature_flag_called", legacy_event_person),
+ )
+ if event in expected_events
+ ]
+ assert sorted(uuids) == sorted(expected_uuids)
def test_fetch_exposed_person_uuids_ignores_test_account_filters(self) -> None:
# filterTestAccounts shapes which exposures are *analyzed*; the snapshot decides who keeps
diff --git a/products/experiments/backend/test/test_session_buckets_api.py b/products/experiments/backend/test/test_session_buckets_api.py
index d3d33a5661f8..84b2b7958a48 100644
--- a/products/experiments/backend/test/test_session_buckets_api.py
+++ b/products/experiments/backend/test/test_session_buckets_api.py
@@ -536,15 +536,15 @@ class TestExperimentSessionBuckets(ClickhouseTestMixin, APILicensedTest):
@parameterized.expand(
[
- # (name, rollout flag enabled, experiment start offset from the cutoff, expected event)
- ("after_cutoff", True, 7, EXPERIMENT_EXPOSURE_EVENT),
- ("after_cutoff_flag_disabled", False, 7, "$feature_flag_called"),
- ("before_cutoff", True, -7, "$feature_flag_called"),
+ # (name, rollout flag enabled, experiment start offset from the cutoff, events read)
+ ("after_cutoff", True, 7, {EXPERIMENT_EXPOSURE_EVENT}),
+ ("after_cutoff_flag_disabled", False, 7, {"$feature_flag_called", EXPERIMENT_EXPOSURE_EVENT}),
+ ("before_cutoff", True, -7, {"$feature_flag_called", EXPERIMENT_EXPOSURE_EVENT}),
]
)
@time_machine.travel(EXPERIMENT_EXPOSURE_EVENT_CUTOFF + timedelta(days=10), tick=False)
def test_bucket_population_reads_the_resolved_exposure_event(
- self, _name: str, flag_enabled: bool, start_offset_days: int, expected_event: str
+ self, _name: str, flag_enabled: bool, start_offset_days: int, expected_events: set[str]
) -> None:
# setUp logged in under the class-level freeze, months before this test's frozen clock,
# so that session has expired; log in again inside the window.
@@ -578,14 +578,19 @@ class TestExperimentSessionBuckets(ClickhouseTestMixin, APILicensedTest):
with patch("posthoganalytics.feature_enabled", side_effect=fake_feature_enabled):
response = self._post_bucket(experiment, bucket="fired_any", metric_uuids=[PURCHASE_METRIC["uuid"]])
- # The analysis queries resolve the default exposure event per experiment
- # (resolve_default_exposure_event), and the playlist ANDs these ids with an exposure
- # filter the frontend builds from the same resolved event. A bucket read off the other
- # event intersects two different populations once the two events stop being emitted
- # together.
+ # The bucket must hold the population the analysis queries count. An experiment on
+ # $feature_flag_called reads both events, because the $experiment_exposure copy carries
+ # the exposures once ingestion stops writing $feature_flag_called to events.
assert response.status_code == status.HTTP_200_OK, response.json()
- expected_session = new_event_session if expected_event == EXPERIMENT_EXPOSURE_EVENT else legacy_event_session
- assert response.json()["session_ids"] == [expected_session]
+ expected_sessions = [
+ session
+ for event, session in (
+ (EXPERIMENT_EXPOSURE_EVENT, new_event_session),
+ ("$feature_flag_called", legacy_event_session),
+ )
+ if event in expected_events
+ ]
+ assert sorted(response.json()["session_ids"]) == sorted(expected_sessions)
# $experiment_exposure is emitted for every experiment, so matching it must still require
# this experiment's flag key.
assert other_flag_session not in response.json()["session_ids"]
diff --git a/products/experiments/backend/test/test_session_context_api.py b/products/experiments/backend/test/test_session_context_api.py
index a3d6f7cd8ed9..25e4ba3338de 100644
--- a/products/experiments/backend/test/test_session_context_api.py
+++ b/products/experiments/backend/test/test_session_context_api.py
@@ -222,10 +222,18 @@ class TestSessionExperimentContext(ClickhouseTestMixin, APILicensedTest):
assert tagged_products
assert set(tagged_products) == {Product.EXPERIMENTS}
- def test_resolves_variant_from_flag_called_event(self) -> None:
+ @parameterized.expand(
+ [
+ ("flag_call", "$feature_flag_called"),
+ # The copy alone, as for an organization whose $feature_flag_called no longer reaches events.
+ ("exposure_copy_only", "$experiment_exposure"),
+ ]
+ )
+ def test_resolves_variant_from_flag_called_event(self, _name: str, event: str) -> None:
self._create_recording()
experiment = self._create_experiment()
self._create_session_event(
+ event=event,
properties={"$feature_flag": "checkout-cta", "$feature_flag_response": "test"},
)
flush_persons_and_events()
diff --git a/products/experiments/mcp/tools.yaml b/products/experiments/mcp/tools.yaml
index aafe175c0036..68fd1f88a431 100644
--- a/products/experiments/mcp/tools.yaml
+++ b/products/experiments/mcp/tools.yaml
@@ -554,7 +554,9 @@ tools:
ended, running_time_calculation (minimum detectable effect, recommended running time and sample size),
stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no
custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure;
- use it in SQL instead of hardcoding either name).
+ use it in SQL instead of hardcoding either name. When it is $feature_flag_called, also read
+ $experiment_exposure (event IN ('$feature_flag_called', '$experiment_exposure')), and count persons, not
+ rows).
param_overrides:
id:
cast: string-int
diff --git a/products/experiments/skills/configuring-experiment-analytics/SKILL.md b/products/experiments/skills/configuring-experiment-analytics/SKILL.md
index 725c8e1d7597..c9673a8ae258 100644
--- a/products/experiments/skills/configuring-experiment-analytics/SKILL.md
+++ b/products/experiments/skills/configuring-experiment-analytics/SKILL.md
@@ -15,7 +15,7 @@ Exposure criteria determine which users are counted in the experiment analysis.
Two options:
-1. **Default exposure event** — users are included when the experiment's default exposure event fires for the experiment's flag: `$feature_flag_called`, or `$experiment_exposure` for newer experiments. Which one applies is resolved server-side — read `resolved_exposure_event` from `experiment-get` rather than assuming either name (both events carry the same properties). This is the standard approach — it means a user is included only when they actually encounter the feature flag in your code.
+1. **Default exposure event** — users are included when the experiment's default exposure event fires for the experiment's flag: `$feature_flag_called`, or `$experiment_exposure` for newer experiments. Which one applies is resolved server-side — read `resolved_exposure_event` from `experiment-get` rather than assuming either name (both events carry the same properties). When it is `$feature_flag_called`, also read `$experiment_exposure` (`event IN ('$feature_flag_called', '$experiment_exposure')`), and count persons, not rows. This is the standard approach — it means a user is included only when they actually encounter the feature flag in your code.
2. **Custom exposure event** — users are included when a specific custom event fires. Use this when you want tighter control over who enters the analysis (e.g., only users who actually visit the page where the experiment runs).
### Multiple variant handling
diff --git a/products/experiments/skills/diagnosing-experiment-health/SKILL.md b/products/experiments/skills/diagnosing-experiment-health/SKILL.md
index d3acf7272404..8ff1512982a9 100644
--- a/products/experiments/skills/diagnosing-experiment-health/SKILL.md
+++ b/products/experiments/skills/diagnosing-experiment-health/SKILL.md
@@ -42,6 +42,7 @@ Call `experiment-get` and pull these fields. They are inputs for almost every di
- `exposure_criteria.exposure_config` — the exposure event and its property filters.
Unset, or naming `$feature_flag_called`, means the default exposure event: read which one
from `resolved_exposure_event`.
+ When it is `$feature_flag_called`, also read `$experiment_exposure` (`event IN ('$feature_flag_called', '$experiment_exposure')`), and count persons, not rows.
A config that names `$experiment_exposure` counts that event, whatever `resolved_exposure_event` says.
Any other event, or an action, is a _custom exposure event_.
Property filters in the config apply to either (B12).
diff --git a/products/experiments/skills/diagnosing-experiment-health/references/bias-and-skew.md b/products/experiments/skills/diagnosing-experiment-health/references/bias-and-skew.md
index 28fbed8ba3cd..64d1fa3edde7 100644
--- a/products/experiments/skills/diagnosing-experiment-health/references/bias-and-skew.md
+++ b/products/experiments/skills/diagnosing-experiment-health/references/bias-and-skew.md
@@ -38,6 +38,7 @@ problem (A3/A4), not a query-scope problem.
The SQL in this file follows the query rules in `diagnostic-snapshot.md`: the experiment's exposure event, the flag's variant keys, a window with both ends set, and no test-account filter.
The exposure event is `resolved_exposure_event`, unless `exposure_criteria.exposure_config` names `$experiment_exposure`: then it is that event ("Which event, which property" in `diagnostic-snapshot.md`).
+When `resolved_exposure_event` is `$feature_flag_called`, also read `$experiment_exposure` (`event IN ('$feature_flag_called', '$experiment_exposure')`), and count persons, not rows.
The queries count `person_id`.
On a flag aggregated by a group type (`feature_flag.filters.aggregation_group_type_index` is set), put `$group_<index>` in its place and leave out the rows where it is empty.
When a result is compared with `$multiple`, leave out the keys in `excluded_variants`: the experiment never counts them.
diff --git a/products/experiments/skills/diagnosing-experiment-health/references/diagnostic-snapshot.md b/products/experiments/skills/diagnosing-experiment-health/references/diagnostic-snapshot.md
index bbf1446f804a..f3a3ff18cd3b 100644
--- a/products/experiments/skills/diagnosing-experiment-health/references/diagnostic-snapshot.md
+++ b/products/experiments/skills/diagnosing-experiment-health/references/diagnostic-snapshot.md
@@ -117,8 +117,9 @@ Query them when a diagnostic asks for exactly that.
Every query in this skill follows them.
-- **One event name.** For the default exposure: the experiment's `resolved_exposure_event` from `experiment-get`.
+- **The default exposure event.** For the default exposure: the experiment's `resolved_exposure_event` from `experiment-get`.
Do not hardcode `$feature_flag_called`.
+ When `resolved_exposure_event` is `$feature_flag_called`, also read `$experiment_exposure`: write `event IN ('$feature_flag_called', '$experiment_exposure')` wherever a query says `event = '<resolved_exposure_event>'`, and count persons, not rows.
- **Both ends of the time range**, at most 7 days per query, and one day first on a large project.
The whole run of an experiment can be months of events.
A property that is not a materialized column makes every row expensive: keep such a query to one day.
@@ -150,13 +151,17 @@ It is `$experiment_exposure` when the experiment started on or after 2026-09-01
Otherwise it is `$feature_flag_called`.
`resolved_exposure_event` already holds the answer: read it, do not derive it.
+When `resolved_exposure_event` is `$feature_flag_called`, also read `$experiment_exposure` (`event IN ('$feature_flag_called', '$experiment_exposure')`), and count persons, not rows.
+Ingestion stops writing `$feature_flag_called` to the events table for some organizations, and the copy then carries the exposures.
+Before that, a flag call and its copy are two rows for one exposure.
+
`$experiment_exposure` is a copy of `$feature_flag_called`, written at ingestion with the same properties.
It is written for every string response other than `true`, `false` and the empty value: a variant key, and also `holdout-<id>` or a key in another spelling.
A response of `true`, `false` or an empty value has no copy.
So a question about responses that are no variant (A10 in `bias-and-skew.md`) needs `$feature_flag_called`.
The copy is switched on per project, apart from the setting that makes an experiment read it.
-When `resolved_exposure_event` is `$experiment_exposure`, that event has no rows for the flag, and `$feature_flag_called` has variant responses in the same window, the copy is not written for the project.
+When `resolved_exposure_event` is `$experiment_exposure`, the query window is on or after 2026-09-01 (UTC), that event has no rows for the flag, and `$feature_flag_called` has variant responses in the same window, the copy is not written for the project.
That is not a fault of the SDK or of the application: say so, and point the user to PostHog support.
<!-- Source for maintainers (may rot): resolve_default_exposure_event and EXPERIMENT_EXPOSURE_EVENT_CUTOFF in
@@ -218,6 +223,7 @@ Read off:
Both: the closing section of `empty-experiment.md`.
- **`events` far above `persons`** is normal.
The experiment counts each person once.
+ When the query reads both flag-call events, `events` also counts a flag call and its copy as two rows.
### By day and library
diff --git a/products/experiments/skills/diagnosing-experiment-health/references/empty-experiment.md b/products/experiments/skills/diagnosing-experiment-health/references/empty-experiment.md
index 942c20fce399..3e288f3f981e 100644
--- a/products/experiments/skills/diagnosing-experiment-health/references/empty-experiment.md
+++ b/products/experiments/skills/diagnosing-experiment-health/references/empty-experiment.md
@@ -5,6 +5,7 @@ SDK call → exposure event captured → ingested → matches the configured exp
**Which exposure event?** When `exposure_criteria` names no custom event, the experiment counts exposures on its default event.
Read it from `resolved_exposure_event` in `experiment-get`: `$feature_flag_called`, or `$experiment_exposure` for an experiment that started on or after 2026-09-01 (UTC) in a project that is in the rollout of that event.
+When it is `$feature_flag_called`, also read `$experiment_exposure` (`event IN ('$feature_flag_called', '$experiment_exposure')`), and count persons, not rows.
An `exposure_criteria.exposure_config` that names `$experiment_exposure` counts that event, whatever `resolved_exposure_event` says.
A config that names `$feature_flag_called` counts the default event, as an absent config does.
`$experiment_exposure` is a copy of `$feature_flag_called`, written at ingestion with the same properties, and only for a string response other than `true`, `false` and the empty value.
diff --git a/products/experiments/skills/scanning-experiments-with-replay-vision/SKILL.md b/products/experiments/skills/scanning-experiments-with-replay-vision/SKILL.md
index 30d3d002d720..f29e86b68205 100644
--- a/products/experiments/skills/scanning-experiments-with-replay-vision/SKILL.md
+++ b/products/experiments/skills/scanning-experiments-with-replay-vision/SKILL.md
@@ -115,7 +115,7 @@ For triage, drilling into recordings, and acting on findings, hand off to [[expl
The observation carries `session_id` and flattened `scanner_output_*` fields (`scanner_output_tags` — a JSON array — for classifiers, `scanner_output_verdict` for monitors, `scanner_output_score` for scorers). Join each session to its variant via the exposure event. **`resolved_exposure_event` names only the _default_ event — it is blind to a custom `exposure_config`, which the scan population (Step 2) does honor.** So derive both the event and the variant property from `exposure_criteria` the way the analysis does (`get_exposure_event_and_property`), or the join reads an event the scanner never observed and the tally comes back empty or wrong:
-- **No `exposure_config`, or one naming `$feature_flag_called`:** join on `resolved_exposure_event` (`$feature_flag_called`, or `$experiment_exposure` once the experiment is on the new event) and read the variant from `$feature_flag_response`. This is the case the SQL below is written for.
+- **No `exposure_config`, or one naming `$feature_flag_called`:** join on `resolved_exposure_event` (`$feature_flag_called`, or `$experiment_exposure` once the experiment is on the new event) and read the variant from `$feature_flag_response`. When it is `$feature_flag_called`, also read `$experiment_exposure` (`event IN ('$feature_flag_called', '$experiment_exposure')`); the sub-select's `GROUP BY session_id` counts each session once. This is the case the SQL below is written for.
- **`exposure_config` naming `$experiment_exposure`:** join on `$experiment_exposure`, variant still from `$feature_flag_response` — even when `resolved_exposure_event` is still `$feature_flag_called`. Keep the `properties.$feature_flag` filter; ingestion emits `$experiment_exposure` for every experiment.
- **A custom event `exposure_config`:** join on that event, but read the variant from `$feature/<flag_key>` (the custom event carries no `$feature_flag_response`) and drop the `properties.$feature_flag` filter — the event name already scopes the join.
- **An action `exposure_config`:** the exposure spans several events, so there is no single event to join on — skip the exposure sub-select and read the variant from `$feature/<flag_key>` over the session's own events, the fallback described after the query.
diff --git a/products/signals/skills/signals-scout-experiments/SKILL.md b/products/signals/skills/signals-scout-experiments/SKILL.md
index 30b90654432a..78230e9dddcc 100644
--- a/products/signals/skills/signals-scout-experiments/SKILL.md
+++ b/products/signals/skills/signals-scout-experiments/SKILL.md
@@ -94,7 +94,7 @@ Two caveats before trusting a clean p-value:
- It tests against the **current** configured split. If variants were redistributed mid-run, post-edit balance can look clean while pre-edit data is contaminated — check the flag history (below) whenever `feature_flag.version` is high.
- It says nothing about `$multiple` — read `bias_risk.multiple_variant_percentage` as its own check (below).
-When the tool can't serve the experiment (legacy metrics) or you need to date an onset, fall back to the exposure SQL. Read the default exposure event off `experiment-get`'s `resolved_exposure_event` (`$feature_flag_called` or `$experiment_exposure` — resolved server-side, same properties either way):
+When the tool can't serve the experiment (legacy metrics) or you need to date an onset, fall back to the exposure SQL. Read the default exposure event off `experiment-get`'s `resolved_exposure_event` (`$feature_flag_called` or `$experiment_exposure` — resolved server-side, same properties either way). When it is `$feature_flag_called`, also read `$experiment_exposure` (`event IN ('$feature_flag_called', '$experiment_exposure')`), and count persons, not rows:
```sql
SELECT
@@ -153,7 +153,7 @@ Both are report-worthy: the team thinks they're collecting evidence and they are
#### Exposure stall / dormant experiment
-A running experiment should accrue exposures continuously. Read the per-variant `exposures.timeseries` off `experiment-results-get` (cumulative daily counts — a flat tail is the stall shape), or by SQL. **Query the experiment's actual exposure event**: default experiments use `resolved_exposure_event` from `experiment-get` (`$feature_flag_called` or `$experiment_exposure`), but if `exposure_criteria.exposure_config.event` is set, query that event name instead (filtering on `properties.$feature/<flag-key>` rather than `$feature_flag`) — running the wrong event's query returns zero rows and fakes a stall:
+A running experiment should accrue exposures continuously. Read the per-variant `exposures.timeseries` off `experiment-results-get` (cumulative daily counts — a flat tail is the stall shape), or by SQL. **Query the experiment's actual exposure event**: default experiments use `resolved_exposure_event` from `experiment-get` (`$feature_flag_called` or `$experiment_exposure`), but if `exposure_criteria.exposure_config.event` is set, query that event name instead (filtering on `properties.$feature/<flag-key>` rather than `$feature_flag`) — running the wrong event's query returns zero rows and fakes a stall. When `resolved_exposure_event` is `$feature_flag_called`, also read `$experiment_exposure` (`event IN ('$feature_flag_called', '$experiment_exposure')`), and count persons, not rows:
```sql
SELECT toDate(timestamp) AS day, count() AS exposures
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index b2ce68a1c54d..79701d627b6e 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -5128,7 +5128,7 @@
}
},
"experiment-get": {
- "description": "Get a single experiment by ID. If you have the experiment's feature flag key instead of its ID, call experiment-get-by-flag-key. If you have neither, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, running_time_calculation (minimum detectable effect, recommended running time and sample size), stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead of hardcoding either name).",
+ "description": "Get a single experiment by ID. If you have the experiment's feature flag key instead of its ID, call experiment-get-by-flag-key. If you have neither, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, running_time_calculation (minimum detectable effect, recommended running time and sample size), stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead of hardcoding either name. When it is $feature_flag_called, also read $experiment_exposure (event IN ('$feature_flag_called', '$experiment_exposure')), and count persons, not rows).",
"category": "Experiments",
"feature": "experiments",
"summary": "Get experiment details",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index d423f901c9fa..f390637f35d6 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -5199,7 +5199,7 @@
}
},
"experiment-get": {
- "description": "Get a single experiment by ID. If you have the experiment's feature flag key instead of its ID, call experiment-get-by-flag-key. If you have neither, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, running_time_calculation (minimum detectable effect, recommended running time and sample size), stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead of hardcoding either name).",
+ "description": "Get a single experiment by ID. If you have the experiment's feature flag key instead of its ID, call experiment-get-by-flag-key. If you have neither, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, running_time_calculation (minimum detectable effect, recommended running time and sample size), stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead of hardcoding either name. When it is $feature_flag_called, also read $experiment_exposure (event IN ('$feature_flag_called', '$experiment_exposure')), and count persons, not rows).",
"category": "Experiments",
"feature": "experiments",
"summary": "Get experiment details",